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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.