This project is read-only.

Suggestions for the web service $.ajax() snippet


A few things I'd suggest, re: jqajaxaspnetwebservice.
  • No need to make the dataType a parameter. It will always be "json".
  • Would be handy if the WebService and WebMethodName portion of the url were separate parameters. Maybe make all of WebService.asmx a parameter so that page method users could type PageName.aspx easily.
  • The data parameter's key and value should both be single-quoted, to be valid JSON. I don't know how commonly the use case would be a single parameter, but maybe go ahead and make "name" and "value" parameters in the snippet?
  • A success callback of
success: function(msg) {


Might be nice. Maybe "data" instead of "msg". Not sure what most people prefer. Possibly similar handlers for error and timeout too, but almost everyone will definitely need the success handler.