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

[html_data] ajax call to retrieve zero children bug #33

Closed
strikernl opened this issue Jun 7, 2011 · 1 comment
Closed

[html_data] ajax call to retrieve zero children bug #33

strikernl opened this issue Jun 7, 2011 · 1 comment

Comments

@strikernl
Copy link

Version: 1.0-rc3

When I use html_data to dynamically retrieve child nodes as parents are opened, this works fine, however, when I want to return NOTHING, I ran in to the following, which seems like a bug to me:

html_data: {
  ...
  ajax: {
    ...
    success: function (data) {
      ...
      if ($('#someid', data).length==0) return;

This causes all sorts of mayhem (in my case infinite reloading of the ajax call), I found out that by returning ' ' (i.e. any number of spaces), it behaves as expected. I'd expect this to also work if null or undefined or '' is returned.

@vakata
Copy link
Owner

vakata commented Jul 11, 2011

This is because many people do not modify the returned data, and just use the success function for some other logic. If null values are treated as nothing to load this would break a lot of code out there (it simply means - use the same code that the server returned, I do not want to modify).
So just return an empty string with a space. I will think of a workaround for the next version.

@vakata vakata closed this as completed Jul 11, 2011
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

2 participants