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)

About mahmud ahsan

Programming is my passion from high school. I always looking for innovating new ideas and making them real application. I love mobile application and game development as well as web development. Having 4+ years web development experience and 6+ years mobile application development experience on different platform and business on it. My Mobile Apps Portfolio: iThinkdiff.net Mobile Apps

, ,

4 Responses to AJAX -Simple to implement

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

    nice class.
    Can you also post its tutorials too?

  2. 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.

  3. 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….


  4. Virendra Rajput February 13, 2012 at 12:34 am #

    Prototype seems to be easy to learn !