将JSON数据发送到WebMethod

沙克蒂

我正在尝试通过AJAX将一些数据发布到VB.NET WebMethod。

JSON.stringify(myRows) 包含:

{
   "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"
      }
   ]
}

我的AJAX电话是:

$.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

        }
    });

服务器端网络方法是这样的:

<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

当我尝试调试时,AJAX调用显示错误!

沙克蒂

任何仍落在此处的人,以下是解决方法:

<WebMethod()> _
Public Function savesocialloginkeys(ByVal myRows As Object) As String
    '------------Now you can work on myRows with the help of newtonsoft library-----'


End Function

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

将JSON数据发送到WebMethod

来自分类Dev

AngularJS $ http.post-将参数作为JSON发送到ASPX WebMethod

来自分类Dev

如何通过Ajax将JSON正确发送到C#[WebMethod]?

来自分类Dev

将List <String>从iOS发送到C#WebMethod

来自分类Dev

通过Ajax将数据从Javascript发送到JSON,再发送到PHP

来自分类Dev

将大型JSON数据发送到breezecontroller失败

来自分类Dev

将JSON数据发送到SQL Server 2008

来自分类Dev

通过JSON将数据发送到服务器

来自分类Dev

将JSON发送到数据库时出错

来自分类Dev

如何将JSON数据发送到Codeigniter视图

来自分类Dev

将JSON数据从Nodejs Express发送到Backbone

来自分类Dev

将JSON数据发送到SQL Server 2008

来自分类Dev

将JSON数据发送到Laravel服务器

来自分类Dev

如何使用JSON将HTML数据发送到PHP?

来自分类Dev

Javascript:通过ajax将json数据发送到php

来自分类Dev

使用 AS3 将数据发送到 JSON

来自分类Dev

将 json 数据从 javascript Ajax 发送到 php

来自分类Dev

使用 cUrl 将 JSON 数据发送到 Solr

来自分类Dev

以json格式将数据从java发送到javascript

来自分类Dev

如何使用json Ajax将文件和一些输入字符串发送到Codebehind中的webmethod?

来自分类Dev

将数据从类发送到Winform

来自分类Dev

将数据从Unity发送到Raspberry

来自分类Dev

将数据从edittext发送到listview

来自分类Dev

将数据从C发送到python

来自分类Dev

将配置数据发送到websocket

来自分类Dev

将数据从DialogFragment发送到Fragment

来自分类Dev

将数据从活动发送到WearableListenerService

来自分类Dev

将数据从$ .ajax发送到php

来自分类Dev

将数据发送到Firestore很慢