I'm new to jquery and JSON. I have the following JSON structure.
{
"address":{
"suburb":[
"HACKHAM WEST",
"HUNTFIELD HEIGHTS",
"ONKAPARINGA HILLS",
"m"
],
"state":"SA"
}
}
So basically the above is the response from this:
$.ajax({
type:'POST',
url: 'getAddress.php',
data:postCode='+postCode',
success: function(response) {
alert(response)
}
});
So, what I'm trying to get is a variable containing state, and an array containing the suburbs.
datais wrong in your$.ajax. It should bedata: 'postCode='+postCode,