Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery .append() limit?

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #34233
    sdunham
    Member

    Hello,

    This is a long shot since I’m not exactly sure what’s going wrong, but is there any limit to how many elements you can add to the DOM using jQuery’s .append() method?

    Background: I’m putting together a participant list for an event in which we gather information using an online form service (Wufoo). I can then access the data using their API and a jQuery wrapper, and append the appropriate data for each participant to the page (usually between 12-15 fields’ worth of info). We currently have 42 participants, but my script keeps stopping after 36 participants’ info has been appended. I can see that all 42 participant entries are being retrieved by the API call. At first I figured there was something wrong with the 37th entry which was causing an error, but when I remove participants from the list which were previously making it onto the page, the appropriate number of additional participants show up (but never more than 36).

    Any thoughts? Let me know if I haven’t included enough detail!

    -Scott

    #86525
    Mottie
    Member

    It might help if you provided some of the code you are using. And since Wufoo is involved, maybe @chriscoyier has a better solution for you.

    #86526
    Chris Coyier
    Keymaster

    I kinda doubt there is a limit, but that’s interesting. As I’m sure you know, the best bet is getting a live URL up for people to look at.

    #86530
    sdunham
    Member

    Yeah, I suppose that would have been a good idea, now wouldn’t it? Oops!

    http://dnhmsctt.com/WufooApi/JS/ASK/

    (And here’s the actual javascript: http://dnhmsctt.com/WufooApi/JS/ASK/js/ASK_night.js)

    P.S. Ignore the commented out sections in the JS. I’ve been trying various things to figure this out, so there’s a few random things in there…

    #86537
    Chris Coyier
    Keymaster

    Looks like you are getting all the correct data back from the API call, so I’d start cutting junk away till you trim it down to just a few lines of code and still having the problem, to get the clearest view you can.

    #86548
    sdunham
    Member

    Ok, I’ve trimmed it way down.

    http://dnhmsctt.com/WufooApi/JS/ASK/
    http://dnhmsctt.com/WufooApi/JS/ASK/js/ASK_night_debug.js

    Now all the loop does is generate an alert which tells you which iteration you’re on, and basically everything else has been stripped out. It’s kind of annoying, but it really drives home that that loop is consistently breaking after 36 iterations. The reason must be staring me in the face, but I still can’t tell why. Maybe I’ve been staring at this thing for too long… : /

    #86634
    sdunham
    Member

    Eureka, sort of!

    After some tinkering, I figured out that I can get it to loop over every entry if I convert the object the API creates into an array first. This still doesn’t explain why the loop kept breaking after a specific number of iterations when I used the original object, though. I’m going to keep looking into this since it’s bugging me, but in the mean time I’ll move forward with the array method. If anyone has some insight into this mystery, it would be much appreciated!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.