BlackMage Posted September 24, 2009 Share Posted September 24, 2009 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 Quote Link to comment Share on other sites More sharing options...
oumichaelm Posted September 28, 2009 Share Posted September 28, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.