-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to binding data from local json file. What i do wrong in this code? plz #2048
Comments
json file look like this { "results": [ |
i think, it because response time from jquery to get data. |
I think it's because you're using 'this' inside your callback function. var _self = this; $.get('src/Persons.json',function(data){ On Wed, Jul 8, 2015 at 12:57 PM, adisak1618 [email protected]
|
@brian-cruickshank Wowwww!! it work!!! may be i need to read more, why can't use this in callback function |
'this' in javascript is very different than 'this' in object-oriented I've found the "You Don't Know JS" series of books - "this & Object Some online links to check into:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this Brian On Wed, Jul 8, 2015 at 2:20 PM, adisak1618 [email protected] wrote:
|
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 |
Allow multiple paths to be linked using linkPath. Fixes #2048
i use jQuery to get persons.json from local file and set to this.employees. what should i do?
The text was updated successfully, but these errors were encountered: