Jump to content

Always in Loading State


BlackMage

Recommended Posts

The problem currently exist here, http://www.prtrack.net/mypolls.php but to see it work you need to be a member so I'll post what the problem is below:

 

 

I have a function in the javascript that updates a div. The function is this:

 

function updateComboBox(dataSource1, divID1,division, sport){
  

     XMLHttpRequestObject=getXmlHttpRequestObject();

if( XMLHttpRequestObject){
	var obj = document.getElementById(divID1);

	XMLHttpRequestObject.open("POST", dataSource1);
	XMLHttpRequestObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

	XMLHttpRequestObject.onreadystatechange = function()
	{
		if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
			obj.innerHTML=XMLHttpRequestObject.responseText;
		}
		else if( XMLHttpRequestObject.readyState == 0){
			obj.innerHTML="..";
		}
		else if( XMLHttpRequestObject.readyState == 1){
			obj.innerHTML="Loading..";
		}
		else if( XMLHttpRequestObject.readyState == 2){
			obj.innerHTML="Loading....";
		}
		else if( XMLHttpRequestObject.readyState == 3){
			obj.innerHTML="Loading......";
		}
	}
	XMLHttpRequestObject.send("division=" + division + "&sport=" + sport);
}

  
  }//end update

 

And it is called twice through a select box:

<select name="division_box" id="division_box" class="combobox" id="division_box" onchange="updateComboBox('phpscripts/mypolls/refresh_conference.php',  'conference_Inner_Div',  this.form.division_box.value, this.form.sport_box.value);  updateComboBox('phpscripts/mypolls/refresh_region.php','regionInnerDiv', this.form.division_box.value, this.form.sport_box.value); ">
</select>

 

The problem is, only one div is changed while the other remains in readystate==1.

 

Does anyone know what can be causing this problem and how to solve it?

 

 

Thanks

Link to comment
Share on other sites

I was curious about your div's.  You have the first one passed into the function referred to with under scores (conference_inner_Div) and the second camel case(regionInnerDiv).  Most people would stick with the same convention.  Not sure about calling the function twice.  Would this overwrite your object if the first function hasn't finished before the second function begins? maybe pass in a different name for each htmlrequest object.

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.