php - I am trying to post <div> content to database using jquery $.post() -
i want add data table using jquery $.post() method..but not updating. html:this html code
<div id="ant-container" name="text" style="border:1px solid #cccccc;height:300px;width:80%;"> <?php if (isset($_post['submit'])&& $_post['text'] ==''){ echo parseword($myfile); }elseif (isset($_post['text'])) { echo $_post['text'];} </div>
jquery:this jquery code
var div_contents = $('#ant-container').html(); var ides = $('#id').val(); $.post("content.php", { contents:div_contents, id :ides});
in getting both "ides" "div_contents" php:this php code(content.php)
$div = mysql_real_escape_string($_post['contents']); $id = mysql_real_escape_string($_post['id']); $sql ="update `antr_essay` set `annotext`= {$div},`grade`='$_post[grade]',`comments`='$_post[comments]' id=$id"; $update=$db->update($sql); $sql ="update `antr_essay` set `annotext`={$div}, `grade`='$_post[grade]', `comments`='$_post[comments]' id=$id"; $update=$db->update($sql); //var_dump($sql);exit; if (isset($update)){ echo '<div align="center" class="alert alert-success">'; echo "annotation added successfully"; echo '</div>'; } header("loction:annotate.php");
i after submitting not redirecting content.php , table not updating. can id pls me
thanks,
please check spelling of location have given in header().
change
header("loction:annotate.php");
to
header("location:annotate.php");