Skip to content
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

ajaxURLS call back #22

Closed
phken91 opened this issue Jun 13, 2016 · 4 comments
Closed

ajaxURLS call back #22

phken91 opened this issue Jun 13, 2016 · 4 comments

Comments

@phken91
Copy link

phken91 commented Jun 13, 2016

hi @dabeng ,
i am trying your plugin, everything run good,
but i found a bug in ajaxURL function
when i call children function, server side return json data,
but the plugin cannot parse the json data on line 541
if (data.children.length),
if will return
jquery.orgchart.js:541 Uncaught TypeError: Cannot read property 'length' of undefined
and my solution is add dataType: "JSON" on line 538
like this : $.ajax({ 'url': opts.ajaxURL.children + nodeId + '/',dataType: "JSON" })

hope help :D

@dabeng
Copy link
Owner

dabeng commented Jun 14, 2016

Hi @lordzpipo . Literally, this bug implies that the returned data doesn't has "children" property. Are you sure you back-end returns JSON object like the following format:

{
  'children': [
    {...............},
    {...............},
    {...............}
  ]
}

@phken91
Copy link
Author

phken91 commented Jun 14, 2016

hi @dabeng ,
i am returning JSON data with php json_encode()
and yes, i got "chidren" property in my data,
btw, i solve it when i add dataType:"JSON" to line 538.

@dabeng
Copy link
Owner

dabeng commented Jun 14, 2016

All right. Thanks for your testing. It seems that it's necessary to set dataType to "json" in file juery.orgchart.js.

@phken91 phken91 closed this as completed Jun 14, 2016
@dabeng dabeng reopened this Jun 14, 2016
@dabeng dabeng closed this as completed Jun 14, 2016
@rwitchell
Copy link

@dabeng why should the node need a 'children' property? if the property isn't there, it should be considered empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants