By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,398 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,398 IT Pros & Developers. It's quick & easy.

XMLHTTPRequest Permission denied

gagandeepgupta16
P: 56
Hi
i am working on webservice that uses one client side javascript which takes in data from html control, process and POST it to destination webservice.

every thing in the logic is ok and working as desired for the localhost, but when the URL is directing to remote server then its giving me "Permission denied for XMLHTTPRequest.open()".

when searched for it, i found to use server side scripting as well, i.e. client - server scripting is to be implemented. This is what Ajax implements. I tried to find but failed to get a proper solution.

Can anyone suggest me a link or sample client - server script so as to make a proper working solution for webrequests using javascript.

Any help would be appreciated

Thanks in advance
Oct 8 '07 #1
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
The URL you used will most likely be from a different domain.

For the Ajax request, make sure the URL is from the same domain.

Let the server-side script deal with cross-domain requests. JavaScript cannot make cross-domain requests.
Oct 8 '07 #2

RMWChaos
100+
P: 137
Are you accessing your page via localhost or testing your page by directly opening the .htm file (by double-clicking it)? If the website url looks something like c:\[username]\webpage.htm or http://localhost/webpage.htm then this could be your problem.

XMLHttpRequest will give you an "access denied" error if you attempt to run it locally rather than served (via IIS, etc.) or if you attempt to access the page via localhost. I learned this the hard way.

What you need to do instead is assign an IP address to your website (192.168.0.x) and use that as the url -- http://192.168.0.x/webpage.htm.

Hope that helps.
Oct 19 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.