$(function() {
var sineData;
$.ajax({
url : '../_php/loadFromDB.php',
type : 'POST',
data : 'getSines',
dataType : 'json',
success : function (result) {
console.log(result);
sineData=result;
},
error : function () {
alert("error");
}
})
});
Under Console->All->Response in firebug I get the below as expected:
[{"userID":"1","email":"user@mail.com","number":"800.256.6547","ext":"5788","startDay":"Sunday","endDay":"Thursday"}]
but when I look at sineData
it is Undefined.
I want to be able to access these values like sineData[0].email
Where am I going wrong?
async: false,
ended up fixing this for me but probably isnt the best solution for most aplications.