ALOK SHARMA

ALOK SHARMA

  • NA
  • 51
  • 12.7k

How to use Server.MapPath in ajax jquery call while deployin

Aug 14 2015 9:26 AM

I am using WebMethod on my ASPXpage and I call it from jQuery on the same page like this: $.ajax({ type: "POST", url: "WebForm1.aspx/Saveuser", contentType: "application/json; charset=utf-8", data: parameters, dataType: "json", success: AjaxSucceeded, error: AjaxFailed });

This works fine in my debug environment, but when I deploy on the hosting site it does not. The problem seems to be in the URL because on the server the path would be different. So I used Server.MapPath in various ways but none of them worked.

url: '<%= Server.MapPath("~/MyPage.aspx/GetSomeData")%>'

Can anyone overcome this defect ,it's highly urgent.

Thanks in advance.


Answers (1)