I want to get more then 1 value from my php file.
Here is my ajax code
$.ajax({
type: "POST",
url: "insert.php",
data: $(this).serialize(),
success: function(response){
alert(response);
alert(response.dummy_code);
alert(response.user_id);
},
});
and on my insert.php i make this output
echo json_encode(array("dummy_code" => "$dummy_code", "user_id" => "$insertet_user_id"));
As example $dummy_code have to value 5s8374m9f9f3m34mc334 and $user_id the value 14.
With the command
alert(response);
I get this ouput
{"dummy_code":"5s8374m9f9f3m34mc334","user_id":"14"}
And the ouput of the two other commands
undefined
Why response.dummy_code & respone.id dont work?
alert(eval(response.dummy_code));dataTypeoption.