简体   繁体   中英

Ajax cannot reach the post page

I've been spending hours trying to figure out what is wrong with this code, i found out that i cannot reach the updateuser.php file, its on the same directory, the filenames are corret, is there something wrong with this code:

<script>
 function updateuseracc(form, password)
{   
var p = document.createElement("input");

form.appendChild(p);
p.name="p";
p.type="hidden";
p.value=hex_sha512(password.value);
password.value="";

var useremail=$("#curemail").val();


$.post('updateuser.php',{email:useremail,p:p}).done(function(data){
    alert(data);
    });


}
 </script>

Bring up development tools with F12 on Google Chrome, then go to 'Network' option and check if after calling the script a 500 header page is returned. You can check this at the list of resources called that you will see at development bar.

If so, you will know that you are not referring to the script correctly, also you will get information from the parsed URL so you can guess how can you set the path to updateuser.php.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM