Demo search engine
<a class="button" href="javascript:executeSimpleRequest();"><span><span><span>Simple request</span></span></span></a>
<a class="button" href="javascript:executeGetRequest1();"><span><span><span>GET request 1</span></span></span></a>
<a class="button" href="javascript:executeGetRequest2();"><span><span><span>GET request 2</span></span></span></a>
<a class="button" href="javascript:executePostRequest();"><span><span><span>POST request</span></span></span></a>
<div style="margin-top:10px;">
Click on one of the buttons above to execute a request.
</div>
<div id="DivResponse" style="margin-top:15px; padding:10px; background-color:#DDDDDD;">
The response of the Ajax requests will be printed here.
</div>
<script>
/*
* load libraries
*/
toutou.require("toutou.js.ajax");
toutou.require("toutou.html.dom");
/*
* executeSimpleRequest
*/
function executeSimpleRequest() {
var text = toutou.js.ajax.request("./ajaxReply.htm");
tt$("DivResponse").innerHTML = text;
}
/*
* executeGetRequest1
*/
function executeGetRequest1() {
var text = toutou.js.ajax.request("./ajaxReply.php?name=Alfred");
tt$("DivResponse").innerHTML = text;
}
/*
* executeGetRequest2
*/
function executeGetRequest2() {
var text = toutou.js.ajax.request("./ajaxReply.php", { parameters:"name=Roger" } );
tt$("DivResponse").innerHTML = text;
}
/*
* executePostRequest
*/
function executePostRequest() {
var text = toutou.js.ajax.request("./ajaxReply.php", { parameters:"name=Sarah", method:'post' } );
tt$("DivResponse").innerHTML = text;
}
</script>
Simple Ajax synchronous requests
This example shows how to execute an Ajax synchronous request. The Ajax requests in this example return some text which is printed in a DIV element.
Simple request
GET request 1
GET request 2
POST request
Click on one of the buttons above to execute a request.
The response of the Ajax requests will be printed here.
Description
There is not much to describe here. Having a look at the source code should be clear enough.Also have à look at the other Ajax demos for more complex examples.

