Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery ajax always error even when update happens
    text
    copied!<p>When i call the function below:</p> <pre><code>function savePlace(id) { var myName = $('#placeName').val(); var myAtmosphere = $('#placeAtmosphere').val() var myType = $('#placeFoodType').val() var myPrice = $('#placePrice').val(); $.ajax({ type: "POST", url: "savePlace.php", data: {"placeID" : id, "placeName": myName, "placeAtmosphere" : myAtmosphere, "placeType": myType, "placePrice" : myPrice}, dataType:"html", success: function(data){ alert("YES"); }, // error function is always being called - even if database gets updated correctly error: function (data) { alert("no"); } }); return false; } </code></pre> <p>it will run - in that it will execute the php in savePlace.php (which runs a mysql update command). savePlace.php returns nothing currently, but it could return html or text if it's needed. In any case, the error handler is always executed. i have checked in the chrome js inspector, and it reports: </p> <pre><code>statusText:"error" responseText:"" status:0 </code></pre> <p>Here is the mysql code, if that helps</p> <pre><code>&lt;?php require_once 'config/Common.php'; mysqli_report(MYSQLI_REPORT_ALL); $placeID = htmlspecialchars(trim($_POST['placeID'])); $placeID = (int)$placeID; $placeName = htmlspecialchars(trim($_POST['placeName'])); $placeAtmosphere = htmlspecialchars(trim($_POST['placeAtmosphere'])); $placeType = htmlspecialchars(trim($_POST['placeType'])); $placePrice = htmlspecialchars(trim($_POST['placePrice'])); $stmt = $EAE_CON-&gt;prepare("UPDATE EAE_PLACES SET NAME=?,ATMOSPHERE=?,FOOD_TYPE=?,PRICE=? WHERE idEAE_PLACES=?"); $stmt-&gt;bind_param('ssssi',$placeName, $placeAtmosphere, $placeType, $placePrice, $placeID); $stmt-&gt;execute(); echo "Stuff"; ?&gt; </code></pre> <p>Note: I am running on localhost (my local machine, XAMPP)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload