Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Best way into the world of Ajax?

blizeHblizeH ✭✭
edited July 2006 in Vanilla 1.0 Help
A friend and I are considering learning Ajax, it's quite clearly going to become an invaluable tool in the future (and already is for some systems) so we may as well get into it asap and get a little bit of a headstart.

The problem is we're currently nearing the end of development for the site we're working on, all that's left is to create a news ticker and just refine some content, anyway here's my question...

I've been looking into doing a news system using a combination of ASP and Ajax but it doesn't seem to be that simple a process, would we be better off maybe just doing a news ticker (either with a scrolling or fading effect) that displays latest news from a database that has info entered into it via ASP?

Thanks

Comments

  • test
  • The backend doesn't really matter as long as you have some kind of grasp in utilizing javascript and having it work across multiple browsers/platforms as necessary. In reality, "ajax" is nothing more than javascript, and it really depends how you utilize it. The real question is, besides a news ticker, what else will you be using it for along with how much javascript can you understand to perform what you want given the ammount of ajax libraries you can find. News tickers can be executed with a couple lines, you may not even need an entire library for it. However if you want to build more off of a library that included that function, on top of regularly pulling random items at a set interval without a full refresh, then you're talking about something a bit more complex which would require maybe only a few more lines, or an entire library depending how you execute it. In the end though, it's still javascript on the presentation side. How you churn it out on the backend is up to you asp/php/cgi that's your call..
  • ithcyithcy New
    edited May 2006
    ajax is very simple. to make it even easier, just use a library like prototype. here's a simple example using prototype.

    (myfile.html)
    <html><head> <script type="text/javascript" src="prototype.js"></script> // don't forget this <script type="text/javascript"> var url = "myfile.php"; //the php file that will send stuff to ajax var pars = "x=1&y=2" // some parameters to pass to your php file function ReplaceMyDiv() { var MyAjaxObject = new Ajax.Updater('MyDiv', url, {method:'get', parameters: pars}); } </script> </head> <body> <div id="MyDiv">this text will be replaced.</div> <a href="javascript:void(0)" onclick="ReplaceMyDiv()">click this</a> </body></html>

    (myfile.php)
    <?php print "this text should appear in your div when you click the link. by the way, x was {$_GET['x']} and y was {$_GET['y']}."; exit; ?>

    that's it. there's a pretty good guide to prototype at http://www.sergiopereira.com/articles/prototype.js.html. it's got other ajax stuff like auto-refreshing updaters, etc. it's fun to dig into it.
  • I like AjaxLib; it's tiny but gets the job done.
  • ooh, that'll do, thanks. i can use it right away.
  • blizeHblizeH ✭✭
    Only just got back into this, many thanks for the replies guys, I don't suppose there's a sort of "Ajax for dummies" kinda guide around anywhere? :P I've no real use for it as yet, but figure it's the way a lot of web platforms seem to be going nowadays, so it's only a matter of time before I'm asked to create something that implements the use of Ajax. Cheers.
  • First things first, learn javascript, and understand how it applies to the DOM, ajax will then pretty much fall out of thin air.
  • http://www.maxkiesler.com/index.php/weblog/comments/42_recent_ajax_tutorials/
This discussion has been closed.