我有如下代码:
$('#clicker_continue').click(function(){
$.ajax({
type:'POST',
url: 'includes/functions/register_user.php',
data: {
'username':dat_usr,
'email':dat_email,
'password':dat_pas,
'question':dat_que,
'answer':dat_ans,
'ip':data.ip
},
dataType:'html',
succes:function(response){
$('#main_wrapper').append(response);
}
});
当我看到NetworkMonitor并点击#clickerContinue时,我并没有看到Ajax请求register_user.php。出什么问题了?
Spelling mistake in your $.ajax
call. You forget the extra s
on the end of success:
$.ajax({
type:'POST',
url: 'includes/functions/register_user.php',
data: {'username':dat_usr, 'email':dat_email, 'password':dat_pas, 'question':dat_que, 'answer':dat_ans ,'ip':data.ip},
dataType:'html',
success:function(response){
$('#main_wrapper').append(response);
}
});
First mistake is that you have a syntax error: SyntaxError: Unexpected end of input
. })
is missing. This is probably your mistake that stops the request from being made.
Second one is that you have a typo: succes
instead of success
- this would not stop the request from being made but will not detect the response.
$('#clicker_continue').click(function(){
$.ajax({
type:'POST',
url: 'includes/functions/register_user.php',
data: {
'username':dat_usr,
'email':dat_email,
'password':dat_pas,
'question':dat_que,
'answer':dat_ans,
'ip':data.ip
},
dataType:'html',
success:function(response){
$('#main_wrapper').append(response);
}
});
}); // <<< You missed this