【发布时间】:2016-05-25 22:03:38
【问题描述】:
使用 ajax、php 和 jquery 将数据插入数据库时出错,适用于本地主机,但上传到服务器后会出错。
$('#sunsubmit').click(function(){
var insertedvalue = $('#sundayform').serialize();
$('form#sundayform').unbind('sunsubmit');
$.ajax({
type: "POST",
url: "routineinsert/sunday.php",
data: insertedvalue,
beforeSend: function(messageinfo){},
success: function(messageinfo){
var c = customalertbox.render("Message!!",messageinfo);
progressdiv.style.display="none";},
error: function(jqxhr) {
customalertbox.render(jqxhr.responseText);
}
});
它适用于我的计算机,但对于服务器,它甚至没有重定向到插入代码所在的星期日文件,它直接调用错误函数。
【问题讨论】:
-
请出示您的代码以了解您的问题
-
您的应用配置可能有问题。
-
$('#sunsubmit').click(function(){ var insertedvalue = $('#sundayform').serialize(); $('form#sundayform').unbind('sunsubmit '); $.ajax({ type:"POST", url:"routineinsert/sunday.php", data:insertedvalue, beforeSend:function(messageinfo){}, 成功: function(messageinfo) {var c =customalertbox.render ("Message!!",messageinfo); progressdiv.style.display="none";}, error: function(jqxhr) {customalertbox.render(jqxhr.responseText);} });
-
请编辑您的问题并将您的代码粘贴到那里。您是否根据生产服务器更改了 php 上的数据库服务器 ip?
-
可能你的ajax请求的url参数有问题。
标签: javascript php ajax web