Ajax Successful status not received
Hi,
Not receiving the Success returning message for a Ajax call. The MYSQL update request did update the required records.
Not 100% sure how to generate the message.
- $.ajax(
{
type: 'POST',
url: "file.php",
data: {oldemail : oldemail_, newemail : newemail_},
dataType: 'JSON',
success: function(data)
{
$('.calendargrid_email').append("<p> done </p> ");
}
});
file.php
- <?php
- header('Content-Type: application/json');
- // connection string
- $oldemail = trim(strtolower($_POST['oldemail']));
- $newemail = trim(strtolower($_POST['newemail']));
- if ($oldemail) {
-
- $query_upd = $conn->prepare("UPDATE `mytabel` SET `email`= REPLACE (`email`, :_oldemail, :_newemail) WHERE `email` LIKE :_email");
- $query_upd->execute(array(':_email'=>'%'.$oldemail.'%', ':_oldemail'=>$oldemail, ':_newemail'=>$newemail));
-
- echo "done";
- }