没有添加datainto数据库,并且没有在表中显示使用AJAX和PHP附加
我在这个链接中仍然存在同样的问题。 所以,我使用了append
方法。 这是AJAX
代码:
function addFunction() { var selectW = $('#insert_new').val(); var selectW = $('#selectW').val(); var select_at = $('#select_at').val(); var pay = $('#pay').val(); var facture = $('#facture').val(); var select_opt = $('#select_opt').val(); if(pay!="") { $.ajax({ data: {'text': insert_new, 'text': selectW, 'text': select_at, 'text': pay, 'text': facture, 'text': select_opt}, type: "post", url: "insert.php", success: function(response){ if(response=="success") { $('#incident_table').append(''+selectW+' '+select_at+' '+pay+' '+facture+' '+select_opt+' '); $('#selectW').val(''); $('#select_at').val(''); $('#pay').val(''); $('#facture').val(''); $('#select_opt').val(''); } else { alert("No data added"); } }, error: function(){ alert('error; ' + eval(error)); } }); } else { alert("Specify a value of payment please!!"); } }
这里是我删除action=insert.php
和method=post
的表单,并将按钮type=submit
转换为我的