I have an ajax call:
jQuery.ajax({
type: "POST", // HTTP method POST or GET
url: 'inc/functions.php?func=get_usr&id='+usr, //Where to make Ajax calls
success:function(data){
if (data.fname) {
var fname = data.fname;
//alert (fname);
$('#rname').text(fname);
}
},
error:function (xhr, ajaxOptions, thrownError){
alert(thrownError);
}
});
data returns:
fname: "test_fname"
lname: "test_lname"
role: "1"
problem is I can get fname out of it, the alert shows undefined.
This doesnt have to be serialized does it? i have this function working well on another project but i cant figure out why this doesn't work.