1

I want to ask if there is any way to make this work:

         $.ajax({
             type : "POST",
             url : "process.php",
             data : $("#numberform").serialize(),
             success : function(data) {
                 if(data==true){
                  alert("Thats the right number");
                  }
                   else{
                    alert("Thats the wrong number);
                   }
             }
         });

Process.php

if(isset($_POST['number'])){
$numb=$_POST['number'];

if($numb=="1"){
     return true;
   }
   else{
  return false;
        }
}

Is possible to do anything like this? I want to see the returned data from the ajax call on success.

codhxh12
  • 33
  • 3

1 Answers1

1

You can see the returned data with this code on success function

success : function(data) {
             console.log(data);
         }

This may print json format. You choise a key that wish.

More details about php response https://stackoverflow.com/a/4064468/6657711

Community
  • 1
  • 1