icez Posted February 9, 2011 Share Posted February 9, 2011 Hey hey =D Well, first of all, thank you for your time. Also, I'm a complet NEWBIE in JQuery - Ajax What I'm trying to do is When I click on a link, it load the content of an ajax request, the ajax request show me more links where when I click on one, it show me more links........ Anyway, I googled, and it seem that I need an handler of the new content added by ajax, so I found livequery plugin added it... but it handle only one more click and die? after.... so if anybody have an idea... I'M open =D Thank you =D Quote Link to comment Share on other sites More sharing options...
jcanker Posted February 12, 2011 Share Posted February 12, 2011 Roughly speaking, it sounds like you're talking about a multi-dimentional array of link possibilities. Javascript and jQuery doesn't handle multidimentional arrays (but some people on the net have sworn to have developed a workaround. I've not tried them.) I'd simplify the data going back and forth in the jQuery->PHP call. Change your data pattern to just show the base level link(s). When that link is clicked, make another call to get the next level of links for that particular link and show/hide divs or links appropriately. Etc until all the levels have been exhausted. If you are storing the links in a multidimentional array on the php side, you'll have to dance around a little to get to the proper level and key/value pair (which in this case will be another array for the value), but it's not terribly complicated once you get the hang of multidimentional arrays in php. Just grab the right value/array and process it as a separate array to send back to AJAX. I hope that makes sense. I could be way off base, depending on where your data is coming from and how it's stored in the db, but I think this is what you're talking about. Quote Link to comment Share on other sites More sharing options...
jcanker Posted February 13, 2011 Share Posted February 13, 2011 For the record, I brainfarted on my last response. Please forgive me.... Javascript/jQuery DOES support multi-dimentional arrays; I don't why, but I KNOW it's associated arrays that's not supported and I guess a long night got to me. So, just go through the array and for each element at the top level of the array, just loop through the associated values and process those as well. I hope all the coding veterans around here don't hold this against me Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.