0

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.

Raghav
  • 8,772
  • 6
  • 82
  • 106

1 Answers1

2

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?

Kyle B.
  • 5,737
  • 6
  • 39
  • 57
  • I have to pass the full URL in my current scenario, Any luck – Raghav Nov 18 '09 at 18:51
  • @Raghav: why do you have to pass the full URL? – Crescent Fresh Nov 18 '09 at 18:54
  • For example consider my application has been put into a folder say myapplication and this folder is in other existing site say for here only http://www.xyz.com , so the new path will be http://www.xyz.com/myapplication , now for the js files the new path will be http://www.xyz.com/myapplication/myscriptfolder/myfile.js , now here in this case i can't use the relative path , so thats why i took the full path. – Raghav Nov 18 '09 at 18:59