PHP JavaScript AJAX
Using Prototype, AJAX is extremely easy. Following is a small function to perform one of the most basic AJAX funstions, to replace the contents of a div element. Modify the function to have the correct php file to hit and loading gif, then simply pass in the div you want to update and the params you want to send to the php file. You can get great loading gifs from www.ajaxload.info .
JavaScript:
-
function getHTML(div,params){
-
-
var url = 'http://www.bradino.com/inc/ajax.php';
-
$(div).innerHTML='<img src="http://www.bradino.com/images/load.gif">';
-
var myAjax = new Ajax.Updater( {success: div}, url, { method: 'post', parameters: params});
-
-
}
Home | JavaScript | PHP JavaScript AJAX
You’re currently reading “ PHP JavaScript AJAX ,” an entry on BRADINO
- Published:
- 3.25.07 / 7pm
- Category:
- JavaScript












