Raghav
Raghav

Reputation: 9630

Error: [Exception... "Access to restricted URI denied" .... while calling $.ajax method

I am getting this error while calling $.ajax methods

Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "xxxxxx" Line: 19"] Source File: xxxxxxxxx Line: 19

I am passing URL paramter as http://www.xyz.com/myscriptfolder/myfile.js .

The $.ajax method works well when i have the url in the broswer as http://www.xyz.com but it won't work when I have th url in browser like http://xyz.com

Could you suggest me any workaround for it. I have to keep the URL paramter in the form http://..... Also it is not the case of cross domain issue, as i am trying to access the files from the same domain.

Upvotes: 0

Views: 696

Answers (1)

Kyle B.
Kyle B.

Reputation: 5787

You are not allowed to make AJAX requests on another domain, and when the url paths do not match, it thinks they are on different domains.

edit: could you pass the relative url, instead of full path as a workaround? i.e. /path/to/file.aspx instead of http://www.xyz.com/path/to/file.aspx?

Upvotes: 2

Related Questions