Jump to content

Look inside... much simpler xD


icez

Recommended Posts

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

 

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.