2016-05-25 11 views
0

ajax、php、jqueryを使用してデータベースにデータを挿入中にエラーが発生しましたが、ローカルホストで動作します。ajax、phpでデータベースにデータを挿入中にエラーが発生しました

$('#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); 
     } 
}); 

それは私のコンピュータが、しかしではなく、それも挿入コードが直接呼び出す誤差関数に配置され日曜日ファイルにリダイレクトされていないサーバーのためにのために正常に動作します。

+0

あなたの問題を理解するためのコードを表示してください –

+0

あなたのアプリのconfで問題が発生する可能性がありますig。 ( '#sundayform'); –

+0

$( '#sunsubmit')をクリックします(function(){ var insertedvalue = $( '#sundayform');$アヤックス({ タイプ: "POST"、 URL: "routineinsert/sunday.php"、 データ:insertedvalue、 beforeSend:関数(messageinfo){}、 成功:関数(messageinfo){VARのC = customalertbox。 エラー:function(jqxhr){customalertbox.render(jqxhr.responseText);} }); –

答えて

0

あなたの成功の機能は、開口部のブレースが欠落しているように見える:

success: function(messageinfo) 

それは

success: function(messageinfo) { 

これは、あなたが常にフォーマットについて注意している場合は注意することが容易である必要があります:

success: function(messageinfo) <============ 
     var c = customalertbox.render("Message!!",messageinfo); 
     progressdiv.style.display="none"; 
    }, 
    error: function(jqxhr) { 
     customalertbox.render(jqxhr.responseText); 
    } 
+0

オープニングブレースを置くと同じエラーが出る...それはローカルホストでは動作するが、サーバにアップロードした後はサーバでは動作しない –

関連する問題