Hi I have a piece of code which calls upon AJAX and an external file to display something from the database, now the code below works fine but because it is within a loop it always echo's to the top div on the page. Take a look
Code:
<?php
$ajax = new Ajax('displayArea');
?>
<form>
<input type="button" value="Click me" name="name_button" onclick="sendReq('serverfile.php', 'id', '<?=$yt_id?>')" />
</form>
<br/>
<div id="displayArea">
Hello
</div>
Now I understand that this is probably due to the fact that the id for the div's are the same all the way down so it echoes to the top one.
Or I thought I might also have to dynamically change the object name but how do I do this?
Any thoughts? Thanks