I decided to give jQuery a try today and am I ever glad I did. I needed to get some information via Ajax and jQuery saved me a lot of time.Normally, making an Ajax call would involve writing my own handler…trivial but still something that I would have to remember how to do. With jQuery, all you have to do is
$.get(“test.ashx?param1=test”,
function(data, textStatus)
{
// can check the textStatus if desired
// can process the data
});
$.post("test.ashx", {param1: "Text1", param2: "Text2},
function(data)
{
// can process the data
});
And there you have it…an Ajax call with callback function.
NOTE: the callback function will only be called on success. If the Ajax call fails, it does so silently. (jQuery has a lower level implementation, $.ajax() – for more information, see http://docs.jquery.com/Ajax)
Comments
One response to “Ajax in jQuery”
Thank you much for that nice entry.