Forums

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

Home Forums JavaScript A little Ajax+WordPress help needed

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #41725
    bogus
    Participant

    Hey all.

    Now, what I want to accomplish is to load only one post at a time into a div. I made a graphic to show what I hve in mind. Look at ist [here](http://imageshack.us/a/img4/9026/shemev.jpg “”).
    Basically if you click on one of the red containers (blogposts) it should load that particular post into the grey box on top. My mockup is [this](http://tingeltangel.megavillain.org/ “”).

    I use this script for the ajax part:

    I really do’t know how to get it to work. Any hints?

    Help is well appreciated!

    #119695
    bogus
    Participant

    wow thanks jamy!

    do you think your code works with wordpress? I wonder if this line

    $content.load(link + ‘ .stuff’, function(data){
    need something wordpress specific (permalink) so it knows what to load?

    #119697
    bogus
    Participant

    just to doublecheck the way it works:

    after I click on a permalink it will fetch the data from single.php and fill the container div with that?

    i’m a noob :(

    #119701
    bogus
    Participant

    mhh. I’m fiddling around with your mockup and trying to get it in the direction i have in mind.

    now i’ve changed the position of the link, so it’s positioned outside the div i want my content to appear in. That would resemble the situation i have outlined.
    boom, it won’t work anymore.

    Have I linked everything together correctly?

    #119702
    bogus
    Participant

    the code thing is broken somehow. I put the code on codepen [here](http://codepen.io/joe/pen/nhrsj “”).

    #119713
    bogus
    Participant

    yay! here’s my index.php markup

    #119711
    bogus
    Participant

    its the code from my mockup which you can see [here](http://tingeltangel.megavillain.org/ “”).

    #119708
    bogus
    Participant

    ugs, the code paste in this forum is awful! In my code there was an additional div (#main), which should be the container element. the codebox ate it.

    here it is on [codepen](http://codepen.io/joe/pen/iElgb “”). sorry jamy!

    #119741
    bogus
    Participant

    I tried to modify it. and it doesn’t work. :(

    as i’ve shown in my graphic in the first post, #main is my container, the grey boxes below are the posts that are put out by wordpress. I only need to get the single.php to open in #main. but therefore the link can not be inside #main, as i understand this.

    phuu ajax is really hard to get to work.

    #119797
    bogus
    Participant

    yay! thanks so much jamy!

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