smussani
16 Sep 2011, 7:04 AM
Hi,
I am getting a "Invalid JSON Primitive" error on a webservice call to my .asmx web service. It seems like the JSON string for params is getting URL encoded and hence not a valid JSON string. I tried making it into a string but then I get "parameter value not found" error. Can someone help me figure out how to send the parameters and avoid the error?
Ext.Ajax.request({
url: 'http://sencha.mussanisoft.com/webservice/service.asmx/HelloWorldJSON',
method: 'GET',
params: "{ 'myName': 'john' }",
jsonData: { "Alert": {} },
headers: { 'Content-Type': 'application/json;charset=utf-8' },
failure: function (response, opts) {
alert("fail: " + response.responseText);
},
success: function (response, opts) {
alert("success: " + response.responseText);
}
});
Web service:
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHTTpGet:=True)> _
Public Function HelloWorldJSON(ByVal myName As String) As String
Return "JSON Hello - " & myName
End Function
I am getting a "Invalid JSON Primitive" error on a webservice call to my .asmx web service. It seems like the JSON string for params is getting URL encoded and hence not a valid JSON string. I tried making it into a string but then I get "parameter value not found" error. Can someone help me figure out how to send the parameters and avoid the error?
Ext.Ajax.request({
url: 'http://sencha.mussanisoft.com/webservice/service.asmx/HelloWorldJSON',
method: 'GET',
params: "{ 'myName': 'john' }",
jsonData: { "Alert": {} },
headers: { 'Content-Type': 'application/json;charset=utf-8' },
failure: function (response, opts) {
alert("fail: " + response.responseText);
},
success: function (response, opts) {
alert("success: " + response.responseText);
}
});
Web service:
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHTTpGet:=True)> _
Public Function HelloWorldJSON(ByVal myName As String) As String
Return "JSON Hello - " & myName
End Function