duanmu2941 2016-09-13 13:48
浏览 79
已采纳

Ajax POST 500内部错误

I have a problem with my ajax call. It gives me the error shown below. I have looked around here and at Google to find the problem, but I did not find a solution. So, I hope someone can the mistake I've made.

console.log shows that the variable is working fine. So I know 100% the error is in the ajax call.

jquery-2.1.1.min.js:4 POST http://localhost:8888 500 (Internal Server Error)
send 
@ jquery-2.1.1.min.js:4
ajax @ jquery-2.1.1.min.js:4
(anonymous function) @ script.js:61
if (isConfirm) {
                    var aanhef = $('select[name="aanhef"]').val();
                    var username = $('input[name="username"]').val();
                    var achternaam = $('input[name="achternaam"]').val();
                    var adres = $('input[name="adres"]').val();
                    var plaats = $('input[name="plaats"]').val();
                    var postcode = $('input[name="postcode"]').val();
                    var email = $('input[name="email"]').val();
                    var tell = $('input[name="tell"]').val();
                    var where = $('input[name="hidden_email"]').val();
                    }

            console.log(aanhef + ' ' + username + ' ' + achternaam + ' ' + adres + ' ' + plaats + ' ' + postcode + ' ' + email + ' ' + tell + ' ' + where);

            $.ajax({
                type: 'post',
                url: 'config/save_profiel.php',
                data: { 'aanhef': aanhef, 'naam': username, 'achternaam': achternaam, 'adres': adres, 'plaats': plaats,  'postcode': postcode, 'email': email, 'tell': tell, 'where': where}
            });



$aanhef = mysqli_real_escape_spring($conn,$_POST['aanhef']);
$name = mysqli_real_escape_spring($conn,$_POST['username']);
$achternaam = mysqli_real_escape_spring($conn,$_POST['achternaam']);
$adres = mysqli_real_escape_spring($conn,$_POST['adres']);
$plaats = mysqli_real_escape_spring($conn,$_POST['plaats']);
$postcode = mysqli_real_escape_spring($conn,$_POST['postcode']);
$email = mysqli_real_escape_spring($conn,$_POST['email']);
$tell = mysqli_real_escape_spring($conn,$_POST['tell']);
$where = mysqli_real_escape_spring($conn,$_POST['where']);
$first = '1';



$updateUser = "UPDATE users SET aanhef='$aanhef', name='$name', last_name='$achternaam', telefoon='$tell', adres='$adres', plaats='$plaats', postcode='$postcode', first_login='$first' WHERE email='$where'";

if ($updateUser) {
    mysqli_query($conn,$updateUser) or die (mysqli_error($conn));
}
  • 写回答

1条回答 默认 最新

  • duanke1286 2016-09-13 14:04
    关注

    As I noted in a comment above, HTTP 500 indicates a generic server-side error. Anytime you see it your first step should be to check your logs.

    You did that, and you found the following message:

    PHP Fatal error: Call to undefined function mysqli_real_escape_spring() in /Applications/MAMP/htdocs/save_profiel.php

    That seems to point the way pretty clearly: You've misspelled mysqli_real_escape_string.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题