I'm trying to POST some data to a VB.NET WebMethod via AJAX.
JSON.stringify(myRows)
contains:
{
"myRows":[
{
"UniqueId":"188",
"Description":"hello",
"ClientId":"321",
"SecretKey":"dftete",
"Active":"checked",
"Delete":"delete icon"
},
{
"UniqueId":"191",
"Description":"sfsss",
"ClientId":"fsdfs",
"SecretKey":"cvvcvb",
"Active":"unchecked",
"Delete":"delete icon"
},
{
"UniqueId":"201",
"Description":"I am test singh",
"ClientId":"23424242",
"SecretKey":";kfddgdfl;ghf",
"Active":"unchecked",
"Delete":"delete icon"
},
{
"UniqueId":"202",
"Description":"Yay mai ban ne wala hun",
"ClientId":"n.csdvnsssl",
"SecretKey":"nj.ssdnfvel,vgd",
"Active":"unchecked",
"Delete":"delete icon"
}
]
}
My AJAX call is:
$.ajax({
type: "POST",
url: "MyWebServiceUtilities.asmx/savesocialloginkeys",
data: JSON.stringify(myRows),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
//some code here
},
failure: function (response) {
//some code here
},
error: function (response) {
//some code here
}
});
Server side web method is this:
<WebMethod()> _
Public Function savesocialloginkeys(ByVal myrows As String) As String
Dim response As String = ""
'------------Some code here-------------------------------
'------------Response will be based on results as per code-------
Return response
End Function
When I tried to debug, AJAX call is showing error!
Anyone who still lands here, here is the solution:
<WebMethod()> _
Public Function savesocialloginkeys(ByVal myRows As Object) As String
'------------Now you can work on myRows with the help of newtonsoft library-----'
End Function