Jump to content

help with span and ajax!


countdrac

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/83237-help-with-span-and-ajax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.