Jump to content

Ajax


watagal

Recommended Posts

Greetings,I can get the Ajax test page (see my previous post) to work in Internet Explorer v6, but it fails in FireFox107. I've traced it down to my JS "getAjaxData()" function @ "oAjax.open("GET",dataSource);". I get the following error in the js console: "Error: uncaught exception: Permission denied to call method XMLHttpRequest.open".

function getAjaxData(dataSource,divId) {	if (oAjax) {  oAjax.open("GET",dataSource);    oAjax.onreadystatechange = function()  { 	 if (oAjax.readyState == 4 && oAjax.status == 200)	document.getElementById(divId).innerHTML = oAjax.responseText;  }  oAjax.send(null);	}}	// getAjaxData()

"oAjax" is my XMLHttpRequest object. Can anyone point me in the right direction?TIA, watagal

Link to comment
Share on other sites

This is the Acceptted Answer to the same problem on experts-exchange.com

Mozilla requires UniversalBrowserRead to use the XMLHttpRequest.open("Some Host") (This ones for you Cd&: http://www.mozilla.org/xmlextras/).  It's a security thing.  If you need to post data, why not consider creating a form with the data you want and using the javascript MyForm.Submit()?
hmm that link seems to be expired hang on...Ahhh this post should answer your questionhttp://www.forum4designers.com/message25416.html
Link to comment
Share on other sites

For those who may be interested -- concerning the XMLHttpRequest.open() method, I found on Mozilla:Ajax:Getting Started the following:

The second parameter is the URL of the page you're requesting. As a security feature, you cannot call pages on 3rd-party domains. Be sure to use the exact domain name on all of your pages or you will get a 'permission denied' error when you call open(). A common pitfall is accessing your site by domain.tld, but attempting to call pages with www.domain.tld.
I assume since I won't be calling 3rd party sites for data retrieval, I can use relative URLs (../code/php/something.php) in my XMLHttpRequestObject.open(). If this a wrong assumption, please let know - i'm still a newbie at this. Relative seems to work in IE6 and FF107.wg
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...