call page method without script manager from jquery

怎甘沉沦 提交于 2019-12-11 13:26:16

问题



How to call page method from jquery without using scriptmanager


回答1:


You can do it this way

$.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)
{ }



回答2:


Excellent guide here: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/



来源:https://stackoverflow.com/questions/5325721/call-page-method-without-script-manager-from-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!