Ajax Successful status not received

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.






  1. $.ajax(
                        {
                            type: 'POST',
                            url: "file.php",
                            data: {oldemail : oldemail_, newemail : newemail_},
                            dataType: 'JSON',
                            success: function(data)
                            {
                                $('.calendargrid_email').append("<p> done </p> ");
                            }
                        });










file.php

  1. <?php
  2. header('Content-Type: application/json');
  3. // connection string
  4. $oldemail = trim(strtolower($_POST['oldemail']));
  5. $newemail = trim(strtolower($_POST['newemail']));

  6. if ($oldemail) {
  7.   
  8.     $query_upd = $conn->prepare("UPDATE `mytabel` SET `email`= REPLACE (`email`, :_oldemail, :_newemail) WHERE `email` LIKE :_email");
  9.     $query_upd->execute(array(':_email'=>'%'.$oldemail.'%', ':_oldemail'=>$oldemail, ':_newemail'=>$newemail));
  10.   
  11.         echo "done";
  12. }