Check whether the folder that is holding the folder name live is a vertual directory. Also check whether the jquery file is getting loaded properly in the network tab in the browser.
Thanks & Regards
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
bladde_89
Member
140 Points
147 Posts
jquery ajax call works only on localhost
Nov 23, 2012 01:08 PM|LINK
i m using jquery ajax to get data from an asp.net back end method like this:
$.ajax({ cache: false, type: "POST", url: '<%= Page.ResolveUrl("~/Live/Live.aspx/GetViews") %>', content: "json", contentType: "application/json; charset=utf-8", data: "{ 'Altid' : '" + GetAltId() + "' }", success: function (msg) { $("#backEndCount").text(msg.d); }, fail: function (msg) { $("#backEndCount").text(msg.d); } });and the back end method:
[WebMethod] public static string GetViews(int Altid) { return Live.count(Altid); }this call works fine locally, but on the remote service i get the page html as a response instead of the normal response which is the "d".
what is the problem, thanks.
SohailShaikh
Contributor
6129 Points
1172 Posts
Re: jquery ajax call works only on localhost
Nov 24, 2012 06:08 PM|LINK
Check this link may be it will help you and please remove Page.ResolverUrl some time its create problem pass complete address like this
../../Live/Live.aspx/GetViews its just sample
http://forums.asp.net/t/1861064.aspx/1?jQuery+Code+not+Firing
Sohail Shaikh
bladde_89
Member
140 Points
147 Posts
Re: jquery ajax call works only on localhost
Nov 24, 2012 06:19 PM|LINK
thank you, but i tried that and it didnt work, the request is "200 ok" but still retrives the current pages html
Yanping Wang...
Star
14919 Points
1537 Posts
Microsoft
Re: jquery ajax call works only on localhost
Nov 28, 2012 06:10 AM|LINK
Hi bladde_89,
Could you deploy the code in some place or share us the example that can reproduce the issue for us to test?
Thanks.
Feedback to us
Develop and promote your apps in Windows Store
pratik_galor...
Participant
1483 Points
330 Posts
Re: jquery ajax call works only on localhost
Nov 28, 2012 06:14 AM|LINK
Remove "contentType: "application/json; charset=utf-8", and then try.
Software Engineer,
iGATE Global Solutions.
pratik_galoria@yahoo.co.in
+91-8905195943
asteranup
All-Star
30184 Points
4906 Posts
Re: jquery ajax call works only on localhost
Nov 28, 2012 06:37 AM|LINK
Hi,
Check whether the folder that is holding the folder name live is a vertual directory. Also check whether the jquery file is getting loaded properly in the network tab in the browser.
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog