This returns the element with the ID of myelement. Want to change the content of a DIV called stuff?
even better the $$() function lets you get lists of objects like
Would return an array of all the div tags in your document or
would return all divs with the class 'myclass'
But what about AJAX?
As I have learned recently AJAX is less about the acronym and more about making calls to other web pages without reloading the current page. This is where PHP & AJAX really make nice friends. With Prototype, making an AJAX call is this simple:
This basically opens a call to the mypage.php page and returns the results to the browser. Now this example doesn't do anything with that result. For that you have to extend things a little, and add in the $() stuff
This code runs the mypage.php page, takes the results of that page and replaces the contents of the element mydiv with it.