我在.net1.1 onload body.My webmethod調用此javascript方法「測試」返回字符串數據,但我無法獲取該數據我的JQuery方法。 在HiddenPage.aspx ==============================JQuery方法控制去成功塊,但msg.d顯示未定義
功能測試() {
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
的代碼@ giftcv,我有added.please檢查我的編輯code..thanks – F11