开发者

how to output the mysqli_error message at during ajax calling while using jquery?

how to output or alert the mysqli error message during an ajax call?

here's my php code

if(isset($_POST['resumetitle']) || isset($_POST['name']) || isset($_POST['dob']) || isset开发者_高级运维($_POST['gender']) || isset($_POST['cvid'])){
    $result =  $db->updatepdetails($_POST['resumetitle'],$_POST['name'],$_POST['dob'],$_POST['gender'],$_POST['cvid']);
    if($result){
      echo "success!";
    } else {
      echo "failed! ".$result->error;
    }
   }

//here's my js code

   $.ajax({
      type: "POST",
      url: "classes/ajax.resumeupdate.php",
      data: "resumeid="+cvid+"&resumetitle="+resumetitle+"&name="+name+"&dob="+dob+"&gender="+gender,
      success: function(msg){
        //window.location = "resumeview.php?cvid="+cvid;
        alert(msg);
      },
   });

after the ajax call, it only pop out the word "failed!" ...i wish to see the mysqli_error too, how's that?


You use $db->error and not $result->error

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜