How to write data option in jQuery.ajax() function when it include in a mysql_query?
- by cj333
I modify a php comment system. I want add it after every article witch are query from database.
this is the php part
<?php
...
while($result = mysql_fetch_array($resultset))
{
$article_title = $result['article_title'];
...
?>
<form id="postform" class="postform">
<input type="hidden" name="title" id="title" value="<?=$article_title;?>" />
<input type="text" name="content" id="content" />
<input type="button" value="Submit" class="Submit" />
</form>
...
<?php
}
?>
this is the ajax part.
$.ajax({
type: "POST",
url: "ajax_post.php",
data: {title:$('#title').val(),
content:$('#content').val()
ajax_post.php
echo $title;
echo $content;
How to modify the ajax data part that each article's comment can send each data to the ajax_post.php? thanks a lot.