OZONE Asylum
Forums
Server-Side Scripting - Oh my!
XMLHttpRequest
This page's ID:
32513
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
I want to send to parameters to a different page but can't get it to work page 1 - JS [code] <script type="text/javascript"> function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } 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() { if (xmlhttp.readyState==4 && xmlhttp.status==200) {var x=document.getElementById("co").value; document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","page2.php?q="+str+"&i="+x,true); xmlhttp.send(); } </script> page 1 - html - php <form action='' name='InsertOrder' method='post' > Select Company: <select name='CoDropDown[]' id='co'><?php for ($i=0; $i < sizeof($Location['LocName']); $i++) { echo "<option value='".$Location['SplitId'][$i]."'> ".$Location['LocName'][$i]."</option>"; }?> </select> Equipment Type: <select name='EquipTypeDropDown[]' id='equi' onchange="showUser(this.value)" ><?php for ($i=0; $i < sizeof($EquipType['Equip']); $i++) { echo "<option value='".$EquipType['Id'][$i]."'> ".$EquipType['Equip'][$i]."</option>"; }?> </select> <span id='txtHint'>************ </span><br><br> page 2 <?php $ProdId=$_GET["q"]; $Id=$_GET["i"]; echo $ProdId."*----*".$Id; echo $_SERVER['QUERY_STRING']; ?> [/code] [Edit TP: added code tags] I've been playing with it for hours but cant get it to work. Can anyone tell me why. It seems like the get element by id is not working inside the function. but it does outside of it. What am I doing wrong? [small](Edited by [url=http://www.ozoneasylum.com/user/1424]Tyberius Prime[/url] on 01-12-2012 10:01)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail