Clients don't pay me on time. So I built this.

jQax – A Simple jQuery Ajax Wrapper with Loading Notification

If you just want a simple way of connecting your web page to a .NET web service or page method using ajax, then the following snippet of javascript is for you. By the way, if you place a div with an id of “divLoader” somewhere on your page, it will automatically fade in during loading and fade out when its complete.

Yeah, Yeah, What do I copy?

That’s all well and good, but how do I use it?

Well Its quite simple, if you have a page method or web service you call It like so (the call using the GET method is much the same):

jQax.CallWebServiceWithJSON(
"MyPage.aspx/MyMethod",
{
parameterName: "parameterValue",
horses: 40
}, // can be any javascript object (if json2.js is enabled), otherwise you must pass in a json string
true, // shows the divLoader
"Custom Text for Loader...", // use null for default
function(data, eventArgs) { // This is called on success
// data is exactly whats returned by the server
// quick and easy JSON parsing can be done like so:
var result = $.parseJSON(data);
// Deal with result here
});

To enable automatic JSON serialization you must download the following and add it to your head section: