Hi.
I´ve seen many tutorials that talks about jquery JSON calls to a webservice.
Basically many of them suggest that you make a webservice call like this:
$.ajax({
type: "POST",
data: "{'SomeText': " + $("#textbox").val() + "}",
url: "/YourWebService.asmx/MethodName",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: functionToCallWhenSucceed,
failure: funcitonToCallWhenFailed
});
But why do I want to do that, when I can call the webservice with more simple code like this:
Namespace.WebserviceName.TheMethod(Variable1, Variable2, functionToCallWhenSucceed, funcitonToCallWhenFailed);
I know that the first option is a POST call, but what difference does it make? And isnt the data transferred from the .net 4.0 webservice not serialized in JSON anyway?
I hope you can help me understand the difference between these ways of communicating with a webservice.
Thanks alot, and kind regards,
Lars