function commentPost(){
$.ajax({
type: "POST",
url: home + "/ajax.php",
data: $('form#commentForm').serialize(),
success: function(x) {
if(x == 0){
$.msgBox({ title: "Uyarı", content: 'Lütfen Formu Boş Bırakmayınız!', });
}elseif(x == 1){
$.msgBox({ title: "Uyarı", content: 'E-Posta Adresiniz Geçersiz!', });
}else{
$.msgBox({ title: "Uyarı", content: 'Başarılı!', });
setTimeout(function(){ window.location = url; }, 2000);
}
},
error: function(x) {
$.msgBox({ title: "Uyarı", content: 'Hata Oluştu!', });
}
});
}Console'da Uncaught SyntaxError: Unexpected identifier hatası alıyorum.
Ajax Post Hata Nerede ?
3
●621
- 13-07-2013, 10:38:11
- 13-07-2013, 13:09:26Denermisiniz :samsunikinciel adlı üyeden alıntı: mesajı görüntüle
function commentPost(){ $.ajax({ type: "POST", url: home + "/ajax.php", data: $('form#commentForm').serialize(), success: function(x) { if(x == 0){ $.msgBox({ title: "Uyarı", content: 'Lütfen Formu Boş Bırakmayınız!', }); }elseif(x == 1){ $.msgBox({ title: "Uyarı", content: 'E-Posta Adresiniz Geçersiz!', }); }else{ $.msgBox({ title: "Uyarı", content: 'Başarılı!', }); setTimeout(function(){ window.location = url; }, 2000); } }, error: function(x) { $.msgBox({ title: "Uyarı", content: 'Hata Oluştu!'}); } }); } - 13-07-2013, 13:28:12kingofseo adlı üyeden alıntı: mesajı görüntüle
Alttaki fazla olan tırnağı kaldırmışsın ama üsttekiler duruyor ayrıca "elseif" yerine "else if" yazılmalı.
function commentPost(){ $.ajax({ type: "POST", url: home + "/ajax.php", data: $('form#commentForm').serialize(), success: function(x) { if(x == 0) { $.msgBox({ title: "Uyarı", content: 'Lütfen Formu Boş Bırakmayınız!'}); } else if(x == 1) { $.msgBox({ title: "Uyarı", content: 'E-Posta Adresiniz Geçersiz!'}); } else { $.msgBox({ title: "Uyarı", content: 'Başarılı!'}); setTimeout(function(){ window.location = url; }, 2000); } }, error: function(x) { $.msgBox({ title: "Uyarı", content: 'Hata Oluştu!'}); } }); } - 13-07-2013, 17:06:37Sorun çözüldü elseif else if olarak düzeltildifrdtrkc adlı üyeden alıntı: mesajı görüntüle