what is the right syntax for a JSON encoded PUT request using jQuery AJAX
This is what I do. Hope it helps:
var WebServiceUrl = 'SomeWebservice.asmx/SomeMethod';var DataToSend = new Object();DataToSend = { FirstName : 'John', LastName : 'Smith' };//Call jQuery ajax$.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: WebServiceUrl, data: JSON.stringify(DataToSend), dataType: "json", success: function (msg) { alert('Success'); }, error: function (err){ alert('Error'); }});
And assuming you have a Webservice. I have a simple ASP.NET VB web service: SomeWebservice.asmx and its method signature as follows:
<WebMethod()> _<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _Public Function SomeMethod(ByVal FirstName As String, ByVal LastName As String) As String