Call ASP.NET PageMethod/WebMethod with jQuery - returns whole page

后端 未结 8 1102
北荒
北荒 2020-11-27 02:57

jQuery 1.3.2, ASP.NET 2.0. Making an AJAX call to a PageMethod (WebMethod) returns the full/whole page instead of just the response. A breakpoint on the page method shows

8条回答
  •  被撕碎了的回忆
    2020-11-27 03:23

    If you have tried all that and still get the whole page returned from your pagemethod, you may want to make sure you are not using friendly urls. If you are using them, this trick may help you

    Add this line on your js script before you make the call:

    PageMethods.set_path(PageMethods.get_path() + '.aspx');
    

提交回复
热议问题