我是一个客户管理系统和IM目前停留在一个问题我一直在试图找出了一个星期的工作得到,现在已江郎才尽不工作阿贾克斯阿贾克斯后,从里面的div
我有index.php基本上它是一个简单的形式,你提交一个客户的名字和姓氏然后阿贾克斯发送请求functions2.php添加到数据库,然后报告成功与否,然后webapp_get_customers检索并更新与新客户的表到webapp_get_customers DIV而无需刷新页面,这是在get.php页面上可以正常使用
然而我有一个从表中选择结果的表,然后在下面添加到b相同的形式e能够编辑客户名称时,我在索引页上编辑其打开窗体中正确的模式,但不是不提交表单,因为它不能找到ajax
所以我追求的是我怎样才能得到它查看webapp_get_customers div来查看表单是否被提交,或者我是否会做出这种错误。即时通讯思想浏览器无法看到驻留在get.php页面上的DIV里面的代码它只是返回加载的内容
请帮助其非常apreciated
<form name='frm_details' class='frm_details' id='frm_details0' action=''>
<input type='text' class='form-control' name='cu_fname' required>
<input type='text' class='form-control' name='cu_lname' required>
<input type='submit' value='Save' >
</form>
<script>
$(function() {
$('form.frm_details').on('submit', function(event) {
event.preventDefault();
$.ajax({
url: '/limitless/functions2.php',
type: 'post',
dataType: 'json',
data: $(this).serialize(),
success: function(data) {
if(data.status == '1')
{
$('#info').addClass('alert alert-danger no-border').html(data.message);
}
if(data.status == '2')
{
$('#info').addClass('alert alert-danger no-border').html(data.message);
}
}
});
});
});
</script>
<script>
function webapp_get_customers(){
$.ajax({
type: 'GET',
url: '/limitless/get.php',
dataType: 'html'
}).done(function(data) {
$('#webapp_get_customers').html(data);
});
}
webapp_get_customers();
</script>
<div id='webapp_get_customers'></div>
您没有传递任何get.php值? – momouu
在现阶段get.php只是显示整个表只有孤单6的客户在那里,它重复和编辑模式的每一行 – Nathan
@Nathan,是你的函数webapp_get_customers被称为? – Nehal