countdrac Posted December 26, 2007 Share Posted December 26, 2007 im having trouble with this ajax! when the javascript function gets called it does what it is supposed but it just puts it in the wrong place - not in the span as its meant to and what is meant to be changed in the span just stays there.... function getSearch() { alert(document.getElementById('searchDiv').value); // this just says 'undefined' document.getElementById('searchDiv').innerHTML = "WHAT???"; //this never appears anywhere ... all othe ajax stuff ... } function StateChangedSearch() { if (xmlHttp.readyState==4) { document.getElementById('searchDiv').innerHTML = xmlHttp.responseText; // this does not insert into 'searchDiv' - it inserts it above where its meant to be } } and then the form and the page.... <form class="uploadForm" name="goNext" onsubmit="return formValidatorUpload()" method="post" > <span id="theForm"> <table> <?php .............. ............ .......... <span id='searchDiv'> <tr><td colspan=1><u>Recently Added Shiurim</u></td></tr>"; $query = "SELECT * FROM shiurim, speakers, category ORDER BY shiur_upload_date DESC LIMIT 5"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr><td>"; echo "Speaker: ".$row['speaker_name'] ."<br />"; echo "Title: ".$row['title'] ."<br />"; echo "Year: ".$row['shiur_year'] ."<br />"; echo "Category: ".$row['category_name'] ."<br />"; echo "Description: ".$row['description'] ."<br />"; echo "Date: ".$row['shiur_date'] ."<br />"; echo "<a href='./audioEditShiur.php?shiur_id=".$row['shiur_id']."'>Edit Shiur</a>"; echo "</tr></td>"; } echo "</span>"; .... ?> </table> </span> </form> thanks! Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 26, 2007 Share Posted December 26, 2007 use tbody instead of a span tag.. it should work Quote Link to comment Share on other sites More sharing options...
countdrac Posted December 26, 2007 Author Share Posted December 26, 2007 thanks it worked! do you know what the problem was? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 27, 2007 Share Posted December 27, 2007 the <span> tag is not part of the table structure unless you put it in a <td> tag therefore anything outside <tr> will be moved above the table.. however Tbody is a part of the table structure. 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.