【发布时间】:2012-12-07 11:56:25
【问题描述】:
我在 .net1.1 onload 的 body 中调用这个 javascript 方法“test”。我的 webmethod 返回字符串数据,但我无法在我的 Jquery 方法中获取该数据。 在 HiddenPage.aspx 中 ===============================
函数测试() {
debugger;
$.ajax({
type: "POST",
url: "HiddenPage.aspx/GetServerTime",
//async : false,
//data: "i=1",
contentType: "application/json",
//dataType: "text",
success: function(msg)
// error: function(, textStatus, errorThrown) {
{
debugger;
alert(msg.d);
},
error: function(msg)
//complete: function (jqXHR, textStatus) {
{
debugger;
alert(msg.d);
alert("Error! Try again...");
//return false;
}
})
// return '';
}
在 HiddenPage.aspx.cs 我放了 webmthod.My WebMethod 是:-
[WebMethod()]
public static string GetServerTime()
{
return DateTime.Now.ToString();
}
【问题讨论】:
-
贴出GetServerTime()的代码
-
@giftcv,我已添加。请检查我编辑的代码..谢谢
标签: c# asp.net jquery-ui jquery