AJAX -Simple to implement

I found Prototype.js http://www.prototypejs.org/download is a nice tool for implementing ajax. You could use it in any framework. Just download the file, and load that by <script src=””>. Then implement the following code
A typical example to how to use ajax:
Ajax.Request is the main function here.
<script type=”text/javascript” language=”javascript”>
function myProcess(action)
url = “”;
url = url + ‘startPHP.php’;
pars = ‘action=’ + action;
myAjax = new Ajax.Request(url, {method: ‘get’, parameters: pars, onLoading: showLoad, onComplete: showResponse, onError: showError} );
function showLoad()
$(‘content’).innerHTML = ” What you want to show”;
function showResponse(response)
var newData = response.responseText;
$(‘content’).innerHTML = newData;
function showError(ale)
mahmud ahsan

Computer programmer and hobbyist photographer from Bangladesh, lives in Malaysia. My [Business | Twitter | Linkedin | Instagram | Flickr | 500px]

You may also like


  • Naseer Ahmad Mughal
    August 21, 2008 at 1:19 pm

    nice class.
    Can you also post its tutorials too?

  • mahmudahsan
    August 21, 2008 at 3:52 pm

    I used this code long times ago. However, JQuery is far better than prototype.js or YUI js framework. So, you could use JQuery for ajax or other javascript tasks.

  • Vinayak
    December 20, 2010 at 9:01 am

    can you suggest the trick to use ajax in blogger or blogspot sites….how can this used in those sites….


  • Virendra Rajput
    February 13, 2012 at 12:34 am

    Prototype seems to be easy to learn !