前端之家收集整理的这篇文章主要介绍了
ajax 页面刷新,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1.
PHP public function actionSavedeDail(){ $update = array('model_id'=>$_POST['id'],'model_
sql'=>$_POST['model_
sql'],'model_
sql_type'=>$_POST['model_
sql_type'],'source'=>$_POST["source"]); $rs = $this->genClass->Save
sql('model_
sql',$update); //echo "
修改成功"; $act=1; $this->assign('act',$act); // $this->display('Task/Detailed'); } 2.view <form method="post" action="./SavedeDail" name="detailForm0" id="detailForm0"> <textarea style="width:100%;height:90%;background:#FFFFCE;" name="model_
sql">{$modellist.model_
sql}</textarea> <input type="button" value="更新" style="margin-bottom:2px;position:absolute;z-index:9999" onclick="SavedeDailSam('detailForm0');" /> <input type="hidden" name="id" value="{$modellist.id}"/> <input type="hidden" name="model_
sql_type" value="0"/> <input type="hidden" name="source" value="0"/> </form> 3.js function SavedeDailSam(id) { var form_id = id; if(!form_id){ return false; } $a=$("#"+id).serialize(); jQuery.ajax({ type: "POST",url: './SavedeDail',data: $("#"+id).serialize(),success: function(data){ alert(data); } }); }