im ajax şey ile yeni im belki çocuklar bana yardımcı olabilir :) Bu kodu aldım, düğmesi ve if (post) aynı php sayfası ve myAjax() içinde Bir komut dosyası.AJAX Gönderi 500 hatası
jquery.js: 4 POST "sitesi/withdraw.php" 500 (Dahili Sunucu Hatası)
Herhangi bir yardım i düğmesini tıkladığında ama bu hata var? :) 500 hatası, sunucunun hata ve JavaScript tamamen bağımsızdır
<button type="button" class="btn btn-success" onclick="myAjax()">Redeem</button>
if($_POST['action'] == 'go')
{
//domethod
}
function myAjax() {
document.getElementById("result").innerHTML += "test";
$.ajax({
type: "POST",
url: 'withdraw.php',
data:{action:'go'},
success:function() {
document.getElementById("result").innerHTML += "test";
}
});
}
<?php
if ($_POST['action'] == 'go') {
go();
} else {
echo "dont work";
}
function go(){
echo "3";
$sql = "INSERT INTO queue (test1, test2, test3) VALUES ('test', 'test', 'test')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
?>
Bize 'page.php' kodunuzu göster – Ferrrmolina
Neden ajax 'withdraw.php' yazıyorsunuz, ancak sunucu 'page.php' hakkında şikayet ediyor? –
oh üzgünüm demek istedim withdraw.php – Peter