
ajax调用C#后台方法失败,求大侠指教
$.ajax({type:"post",contentType:"application/json",url:"NewsEdit.aspx/ShowContent",da...
$.ajax({
type: "post",
contentType: "application/json",
url: "NewsEdit.aspx/ShowContent",
data: "{'Content':'"+content+"'}",
dataType: 'json',
success: function(result) {
}
});
C#代码
using System.Web.Services;
[WebMethod]
public string ShowContent(string Content)
{
txtContent.Value = Content;// txtContent是一个编辑器空间
return "提示:成功!";
} 展开
type: "post",
contentType: "application/json",
url: "NewsEdit.aspx/ShowContent",
data: "{'Content':'"+content+"'}",
dataType: 'json',
success: function(result) {
}
});
C#代码
using System.Web.Services;
[WebMethod]
public string ShowContent(string Content)
{
txtContent.Value = Content;// txtContent是一个编辑器空间
return "提示:成功!";
} 展开
展开全部
调用某个方法是这么掉的吗,该在页面初始化函数里调用showContent,ajax中url写到xx.apx就可以了
展开全部
额 这个返回的是xml格式的文本吧? 如果你按json来读的话………………就杯具咯~
另外,你得看看你发出的请求具体是啥,这个谷歌和火狐都有很好工具来抓。
如果还有问题,就使用原生的AJAX请求试试,避免因为错误的使用jquery而导致的很难发现的问题。
另外,你得看看你发出的请求具体是啥,这个谷歌和火狐都有很好工具来抓。
如果还有问题,就使用原生的AJAX请求试试,避免因为错误的使用jquery而导致的很难发现的问题。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
javascript直接调用webservice,webservice类声名时加System.Web.Script.Services.ScriptService属性。
[System.Web.Script.Services.ScriptService]
public class MyWebService : System.Web.Services.WebService
[System.Web.Script.Services.ScriptService]
public class MyWebService : System.Web.Services.WebService
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
txtContent.Value 这个是Value还是Text啊?
断点调试一下能进方法吗?
还是你没引Jqeury啊
断点调试一下能进方法吗?
还是你没引Jqeury啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用alert检查
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询