1
Answer

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

ALOK SHARMA

ALOK SHARMA

9y
1.2k
1

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)