Forum Moderators: open
$(".commentsubmit").click(function() {
if ($(this).prev()[0].value != "") {
var thiscomment = $(this).parents(".quick_comment_form");
var cbox = thiscomment.next().next();
var mbox = thiscomment.find(".commentmessage");
var tbox = thiscomment.next();
cbox.html("<img src=\"'.uhome().'/files/loading.gif\" /> submitting");
$.post("'.uhome().'/index.php?p=jquery/comment_publish",
{message:mbox[0].value,target_id:tbox[0].value},
function(data){
cbox.html("");
$(".quick_comment_form").css("display","none");
cbox.after(data);
mbox.attr("value","");
},"html"
);
return false;
}
});
<input type="button" value=" comment " class="fbutton commentsubmit" />
// this the button wen i click on it i want to refresh the div .
<div class="user_post_1">
<table width="100%">
<tr>
<td class="user_post_left" width="'.$avatar_box_size.'" valign="top">
'.avatar($row,$avatar_size).'</td>
<td class="user_post_right" valign="top">
<strong>'.url($mu.'u/'.$row['username'], $row['fullname']).'</strong>
'.$att.decode_bb(nl2br(smilecomment($row['message']))).'
<div class="att_bottom">'.$comments_display.'
<abbr class="timeago" title="'.date("c",$row['created']).$likes.'"></abbr></div>
</td>
</tr>
</table>
</div>
function comment_publish() {
global $client, $config;
if (!$client['id']) die('<div class="ferror">login please</div>');
if ( !preg_match("/^[0-9a-z]+$/i",$_POST['target_id']) ) die('no target id');
if (strlen($_POST['message'])<2) die('<div class="ferror">message is too short</div>');
limit_posting(0,1);
comment_insert($_POST['target_id'],$_POST['message']);// this code wich insert in datapage
record_this_posting($_POST['message']);
$arr = array(
'avatar'=>$client['avatar'],'message'=>stripslashes($_POST['message']),'username'=>$client['uname'],'created'=>time()
);
echo comment_display($arr); // this is the Temporary post untill refresh the page
ss_update();
exit;
}
$('Your_Button').click(function(){
var msg = $('msg_element_from_form').val();
$('Targetdiv').text(msg);
});