Jump to content

Sending a request fails if its altered?


cooldude832

Recommended Posts

I have been using this ajax request without an issue

function get_my_events(ads){
var xmlhttp;
if (window.XMLHttpRequest){
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject){
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else{
	alert("Your browser does not support XMLHTTP!");
}
xmlhttp.onreadystatechange=function(){
	if(xmlhttp.readyState==4){
		document.getElementById('events_center').innerHTML="";
		document.getElementById('events_center').innerHTML=xmlhttp.responseText;
	}
}
xmlhttp.open("GET","e_get.php?type=mine&ad="+ads,true);
xmlhttp.send(null);
}

 

However when i try to adapt it in a new function any altercations to it at all and the browser doesn't do anything.  Firebug doesn't even show the request going and I don't see any errors comming through.

 

Any ideas?  I am calling it within a function of a function i.e

get_cats() calls get_subcats() calls get_my_events2();

 

What else I am noticing is firefox doesn't even error when I go to call to an undefined function when the calling name does not match the function name

i.e

function setup_cats(CatID){
	var xmlhttp;
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject){
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else{
		alert("Your browser does not support XMLHTTP!");
	}
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4){
			cats=xmlhttp.responseText;
			cats_split=cats.split(",");
			i = 0;
			cats = cats_split.length;
			cats_status = new Array(cats);
			cats_open = new Array(cats);
			while(i<cats){
				cats_status[i] = 1;
				cats_open[i] = cats_split[i];
				i++;
			}
#SEE THIS LINE BELOW IS GET_MYEVENTS2 BUT NO FUNCTION CALLED THIS ANYWHERE!
			get_my_events2(1);
			events_toggle('open'); 
		}
	}
	xmlhttp.open("GET","cats2.php?p="+CatID,true);
	xmlhttp.send(null);
}

 

and there is no get_my_events2 it is now e_dat but no error (and no loading)

function e_data(ads){
var xmlhttp;
if (window.XMLHttpRequest){
	// code for IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject){
	// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else{
	alert("Your browser does not support XMLHTTP!");
}
xmlhttp.onreadystatechange=function(){
	if(xmlhttp.readyState==4){
		document.getElementById('events_center').innerHTML="";
		document.getElementById('events_center').innerHTML=xmlhttp.responseText;
	}
}
xmlhttp.open("GET","e_get.php?type=cat=&ad="+ads,true);
xmlhttp.send("");
}

 

Any help be great on this cause I'm totally confused

Link to comment
https://forums.phpfreaks.com/topic/179246-sending-a-request-fails-if-its-altered/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.