javascript - How to store div content to DB? -
in project, sheet processing data append timetagdiv div(just , b talking, , content show in dialog).the new message send dialog append timetagdiv div. after want whole timetagdiv html content stores in db ajax. next time, these dialogue content show in div, konw going on.
here js code:
var newcnt="<span class='dlgrsp'><label id='dlgrsptime'></label> <label id='dlgcharge'></label> accept sheet</span><br />"; $('#timetagdiv').append(newcnt); //var tmtgdvhtml=$('#timetagdiv').innerhtml; var tmtgdvhtml=document.getelementbyid("timetagdiv").innerhtml; var slcid = 2; $.ajax({ datatype:'json', type:"post", url:"get_ajax_csc.php", data: {slcid:slcid,htmlcnt:tmtgdvhtml}, success:function (data) {} });
here html code:
<div class="timetag" id="timetagdiv"> <span class="dlgdate" id="firdlgdate"></span><br /> <span class="dlgsttrl"><label id="dlgtime1"></label> <label id="dlgprpsr"></label> create new sheet</span><br /> <div id="dlgdiv1"></div><br /> </div>
here get_ajax_csc.php code:
<?php include ("db.php"); if(isset($_post['htmlcnt'])) { $sql="update idc set shprocess='".$_post['htmlcnt']."' id='".$_post['slcid']."';"; $sel = $conn->exec($sql); } ?>
but unfortnately, these date of timetagdiv can not updated. have tested tmtgdvhtml=document.getelementbyid("timetagdiv").innerhtml can div html content.but have no idea that. can me ?
the div contect of htmlcnt should formatted stripslashes()
$htcnt=stripslashes(".$_post['htmlcnt'].");
it works fine.
Comments
Post a Comment