Prev: FAQ Topic - Why doesn't the global variable "divId" always refer to the element with id="divId"? (2010-08-10)
Next: Bing.com search feedback
From: jr on 9 Aug 2010 23:43 This AJAX function is working except it does not return the responseText to the proper place. What happens is it writes over to the side and there are 2 lists. One is the full select/option list which I want to replace with the AJAX dynamic one instead of getting two lists. I am getting the right values when I select from the second one and do a search, just need the AJAx one to write over the select/option in the form. I can't figure out why it isn't? function fillZoneId() { // alert("get_zonenms.php?bu="+bu+"&zonenm="+zonenm); var bu = document.forms[0].search_bu.value; //var bu= document.getElementById('search_bu').value; var zonenm = document.forms[0].search_zonenm.value; if ( window.XMLHttpRequest ) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{ // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { document.getElementById("searchzoneid").innerHTML=xmlhttp.responseText; } xmlhttp.open("GET","get_zonenms.php?zonenm="+zonenm +"&bu="+bu,true); xmlhttp.send(); } This is the full list in the form that I want the AJAX list to write over. </div></td></tr><tr><th align='right'>Zone Id</th> <div id='searchzoneid'><td><select name='search_zoneid' id='search_zoneid' > <div id='searchzonenm'> <td><select name='search_zonenm' id='search_zonenm' > <option value=''>Select Zone Number</option> </td></tr><tr><th align='right'>Zone Number</th> <div id='searchzonenm'> <td><select name='search_zonenm' id='search_zonenm' > <option value=''>Select Zone Number</option> <option value='BIRTH CONTROL' >BIRTH CONTROL</option> <option value='CIIIS' >CIIIS</option> <option value='CIIS' >CIIS</option> <option value='CLINIC' >CLINIC</option> <option value='COMPOUND' >COMPOUND</option> <option value='controlles' >controlles</option> etc etc etc <option value='TABS' >TABS</option> </select> </div></td></tr> So this list from AJAX and PHP would come with the right selection if it was bu= 08132 and zonenm = ciis for example. Should write over the above list. option value=''>Select Zone Number</option> <option value='OTC'>OTC</option> <option value='FAST MOVERS'>FAST MOVERS</option> <option value='CIIS'>CIIS</option> <option value='SYRINGES'>SYRINGES</option> <option value='BIRTH CONTROL'>BIRTH CONTROL</option> <option value='Rx'>Rx</option> <option value='FRIDGE'>FRIDGE</option> <option value='OVERSTOCK'>OVERSTOCK</option> <option value='CIIIS'>CIIIS</option> <option value='EXPIRED'>EXPIRED</option> </select></td> This should write over the select id=search_zonenm . thanks,
From: rf on 10 Aug 2010 00:14 "jr" <jlrough(a)yahoo.com> wrote in message news:f2876be0-e26b-4fa6-9bc2-b6760e4387ea(a)x18g2000pro.googlegroups.com... > This AJAX function is working except it does not return the > responseText to the proper place. What happens is it writes over to > the side and there are 2 lists. Yes. I've seen this happen many times with grossly invalid HTML. > </div></td></tr><tr><th align='right'>Zone Id</th> > <div id='searchzoneid'><td><select name='search_zoneid' > id='search_zoneid' > > > <div id='searchzonenm'> > <td><select name='search_zonenm' id='search_zonenm' > > <option value=''>Select Zone Number</option> > You *STILL* have grossly invalid HTML. With grossly invalid HTML it is entirely up to the browser do decide what it does with your content. I suggest you refrain from asking any questions until your HTML passes validation. It is absolutely pointless offering any sort of guess as to what is happening as it is.
From: Denis McMahon on 10 Aug 2010 16:05 On 10/08/10 04:43, jr wrote: > This AJAX function is working except it does not return the > responseText to the proper place. Here's one that works. If you can't figure it out the javascript from this, find a different vocation: http://www.sined.co.uk/jr1.zip testops.php is the main form, it includes the javascript testopsdata.php is the xhr server Rgds Denis McMahon
From: jr on 11 Aug 2010 22:48 On Aug 10, 1:05 pm, Denis McMahon <denis.m.f.mcma...(a)googlemail.com> wrote: > On 10/08/10 04:43, jr wrote: > > > This AJAX function is working except it does not return the > > responseText to the proper place. > > Here's one that works. If you can't figure it out the javascript from > this, find a different vocation:http://www.sined.co.uk/jr1.zip > > testops.php is the main form, it includes the javascript > testopsdata.php is the xhr server > > Rgds > > Denis McMahon Hi Denis, I don't have permission to download this zip file. It says forbidden. If you give me permission I'll download it. Rgds, Janis
From: jr on 11 Aug 2010 23:25
On Aug 10, 1:05 pm, Denis McMahon <denis.m.f.mcma...(a)googlemail.com> wrote: > On 10/08/10 04:43, jr wrote: > > > This AJAX function is working except it does not return the > > responseText to the proper place. > > Here's one that works. If you can't figure it out the javascript from > this, find a different vocation:http://www.sined.co.uk/jr1.zip > > testops.php is the main form, it includes the javascript > testopsdata.php is the xhr server > > Rgds > > Denis McMahon By the way, I am starting to understand it and I'm going to go back and finish the other one with the print button. This one is harder since the select in the responseText has to call another javascript function for the 3rd drop down. :-) |