我目前是做從index.php 這頁面 輸入好from資料 submit出去
資料就用ajax post方式傳過去edit.php
然後edit.php再接參數 下 sql 這邊已成功可以運行
然後我現在我想要 edit.php下完SQL後 取$lastID = mysql_insert_id();
取$lastID inssert產生出的sql id 再回傳到 index.php 的 javasciprt 裡的 alert("
成功的單據:" );
想請問版上大大我該如何做才會有?
Javascript index.php
$("#addsubmit").on('click', function () {
$.ajax({
url:"edit.php",
data: '&' + $('#addprepayment').serialize() ,
type: "POST",
datatype: "json",
success: function(msg){
alert("成功的單據:" );
return false;
},
error:function(xhr, ajaxOptions, thrownError){
alert("錯誤\");
}
});
});
PHP edit.php
$lastID = mysql_insert_id();