How do I access the individual php variables after an ajax call? I have two variables returned from message.php $id and $messageid and I need to access these from ajax.
In my php I have:
if($array1){
$id = "1";
$messageid = $messageid;
}
ajax:
$(document).ready(function(){
$('#newmessage').on('submit',function(e) {
$.ajax({
url:'message.php',
data:$(this).serialize(),
type:'POST',
dataType: 'HTML',
success:function(data){
if($.trim(data) == "1") { <-- this needs to be data.id
$("#message").modal("hide"); <-- this needs to be #message.data.messageid
}
else{
alert("error");
}