Hi all..
basically i want an ajax code that retrieve the data from the unique div(with php)..
what i mean by unique here is that my div got the id with the name+(the php code to make it unique).
okay i dont really know how to explain but here is my ajax code :
<script type="text/javascript">
$(document).ready(function(){
$("form#post_reply").submit(function() {
var discuss_text = $('#discuss_text').attr('value');
var test5 = $('#test5').attr('value');
$.ajax({
do something....
}
});
return false;
});
});
</script>
and this is the html part which contain the div that i meant :
<ul id="wall">
<?php
include('insert.php');
$test=mysql_query("SELECT*FROM wall ORDER BY id DESC");
while($row=mysql_fetch_array($test)){
$rel_id=$row['id'];
?>
<li class='stbody'>
<div class='stimg'>
</div>
<div class='sttext'>
<span class='poster'>Name</span><span class='flag_bad'><a href="#">X Flag as bad post</a></span><br/>
<?php echo $row["message"];?>
<div class='below'>
<div class='sttime'>a few seconds ago</div>
<div class='help-toggle'>| Helpful |</div>
</div>
<div class='trigger_default'><a href='#'>Discuss</a>
</div>
<div class='toggle_container_default'>
<ul class="reply_text">
<?php include('get_reply.php');?>
</ul>
<div class='block'>
<form name='disscuss_text' id='post_reply' id='post_reply'>
<input type="hidden" name="test5" id="test5" value="<?php echo $row['id']; ?>">
<textarea id='discuss_text' name='discuss_text'></textarea>
<input type='submit' value='Post' name='Help' id='post-button' />
</form>
</div>
</div>
</div>
</li>
<?php
}
?>
</ul>
</div>
So i got the above code and what i want to do is :
replace this HTML code :
<textarea id='discuss_text' name='discuss_text'></textarea>
with this :
<textarea id='discuss_text_<?php echo $row; ?>' name='discuss_text'></textarea>
and replace this ajx code which is:
var discuss_text = $('#discuss_text').attr('value');
with this :
var discuss_text = $('#discuss_text_<?php echo $row; ?>').attr('value');
When i tried to replace them, i cannot achive what i want to do..If you could understand what i am trying to do, could you give me the solution please??
I really hope that someone could help me out because there has been a week or two i have been thinking about this solution :(