
Loading…
How to binding data from local json file. What i do wrong in this code? plz #2048
json file look like this
{ "results": [
{
"address": "",
"createdAt": "2015-06-13T15:59:54.223Z",
"email": "",
"facebook": "dtac",
"fbID": "dtac",
"fname": "Dtac",
"instagram": "",
"lineID": "",
"listObjID": "CImULW8LTV",
"lname": "",
"nickname": "",
"objectId": "qHAjGpfqP6",
"phone": "1678",
"position": "Data Call Center",
"updatedAt": "2015-06-18T17:34:47.786Z"
}
]}
i think, it because response time from jquery to get data.
@brian-cruickshank Wowwww!! it work!!!
lot of thank :)
may be i need to read more, why can't use this in callback function
I think you can also use the JavaScript Function.bind instead of closure (I prefer this way).
Example:
$.get('src/Persons.json', function(data) {
this.employees = $.parseJSON(data).results;
console.log(this.employees);
}.bind(this));And I think you can close the issue
thank you, it's work also @kevinpschaaf
i use jQuery to get persons.json from local file and set to this.employees. what should i do?