JSON发送到WEBMETHOD? [英] Send JSON to webmethod?

查看:86
本文介绍了JSON发送到WEBMETHOD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何发送一个JSON对象来使用jQuery一个WebMethod?

How can i send a JSON object to a webmethod using jQuery?

推荐答案

请参阅<一个href=\"http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/\">this本文由戴维·沃德。正是在做这个东西一个完整的教程。你还会发现有其他伟大的jQuery / ASP.net的东西。

Please refer to this article by Dave Ward. It is a complete tutorial on doing this stuff. Also you will find there other great jquery/ASP.net stuff.

编辑: - 戴维调用方法不带任何参数,可以更换空的数据财产实际数据要发送:

- Dave is calling method without any arguments, you can replace empty data property with actual data you want to send:

$.ajax({
  type: "POST",
  url: "Default.aspx/GetDate",
  data: "{'name':'tiger1','hobbies':['reading','music']}",//PUT DATA HERE
  contentType: "application/json; charset=utf-8",
  dataType: "json",

这篇关于JSON发送到WEBMETHOD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆