2011-03-16 85 views
1

如何從jQuery的調用頁面方法,無需使用ScriptManager的調用頁面方法從jQuery的

+0

燦您發佈了您嘗試過的代碼,並解釋它未按預期執行的方式以及您想實現的目標。這裏沒有問題。 – Lazarus 2011-03-16 13:09:33

回答

3

你能做到這樣

$.ajax({ 
    type: "POST", 
    contentType: "application/json; charset=utf-8", 
    dataType: "json", 
    url: "webpage.aspx/methodName", 
    data: "{id: '" + id + "'}", 
    success: getTargetSuccess, 
    error: getTargetFailure 
}); 

function getTargetSuccess(result,e) 
{ 
    var data = result.d; 
} 

function getTargetFailure(result,e) 
{ } 
+0

如何將參數傳遞給methodName? – 2013-03-11 05:00:23

+0

找到更新的答案。 – 2013-03-13 08:43:31

+0

明白了!謝謝 – 2013-03-13 09:27:05