AJAX -Simple to implement

Hello,
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)
{
alert(ale);
}</script>
Advertisements