Testing AJAX
This is for me to text AJAX with jQuery.
by mazlix
HTML
<div id="button">
Click here
</div>
<br />
<div style="border:dashed;height:80px;">
<div id ="result">
Content gets loaded here
</div>
</div>
JavaScript
$.ajaxSetup({
cache: false
});
var ajax_load = "<img src='http://dl.dropbox.com/u/4648153/ajax-loader.gif' alt='loading...' />";
var json1 = '{"name":"Jay Kru" ,"sex":"male"}';
show_json = function(responseText) {
$("#result").html(responseText.name +"<br />" + responseText.sex);
};
$(function() {
$("#result").html(ajax_load);
$.post("/echo/json/", {json: json1, delay: 10000}, show_json, "json");
});