Jump to content

xmlHttp.send("null");


PrateekSaxena

Recommended Posts

I am getting this error the Line 90 has xmlHttp.send("null");

uncaught exception: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXMLHttpRequest.send]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: file:///C:/Program%20Files/Apache%20Software%20Foundation/Apache2.2/htdocs/D6S/signup/signup.js :: doXML :: line 91" data: no] on 0 of !

This is the JS file

function doXML(){	var url="signup.php"	for (var i in sign.field)	{		var x = dgebi('div'+sign.field[i]).getElementsByTagName("input");		var other = x[0].value;		if (i!=3 && i!=5) url += "&"+other;	}	xmlHttp=gxho();	if (xmlHttp==null){		alert ("Browser does not support HTTP Request");		return;	}	url+="&sid="+Math.random();	alert(url);	xmlHttp.onreadystatechange=stateChanged;	xmlHttp.open("GET",url,true);	xmlHttp.send(null);}function stateChanged(){ 	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") alert(xmlHttp.responseText);}function gxho(){	var xmlHttp=null;	try{		xmlHttp=new XMLHttpRequest();	}	catch (e){		try{			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");		}		catch (e){			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		}	}	return xmlHttp;}function dgebi(id){	return document.getElementById(id);}

Could someone please tell me what the problem is??This is the same JS as given on http://www.w3schools.com/php/php_ajax_suggest.asp !

Link to comment
Share on other sites

The only thing in your code that I see right away is that your URL would be missing a ? after the filename.You might first try initially setting the url to "signup.php?" instead of "signup.php".

Link to comment
Share on other sites

Thanks it worked, but now I am getting a brand new error, look at this http://workbench.awardspace.com/ . After one clicks on submit, see Firebug

Link to comment
Share on other sites

Thanks it worked, but now I am getting a brand new error, look at this http://workbench.awardspace.com/ . After one clicks on submit, see Firebug
It's because of cross server scripting. The page is being displayed at http://workbench.awardspace.com, and, hence, the javascript is being executed from there. However, the URL for your AJAX request is going to http://localhost/D6S/signup/signup.php?q=0". AJAX doesn't allow that.Try sending the AJAX request to "signup.php?q=0" instead.
Link to comment
Share on other sites

Hello thanks man. That was the stupidest thing error. Acually I was making it all on my server and then I had to upload it on the awardspace server so I forgot to change it. How did you find it out? Is there a tool that you use??

Link to comment
Share on other sites

Hello thanks man. That was the stupidest thing error. Acually I was making it all on my server and then I had to upload it on the awardspace server so I forgot to change it. How did you find it out? Is there a tool that you use??
Not in this case. I just viewed your source and saw that your code referenced a javascript. I viewed that script (by typing in the address in my address bar) and saw the problem.I suppose I could have just clicked on the "Script" tab in Firebug, but that's still a new Firefox extension for me and I'm still stuck with old habits. :)
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...