Home › Forums › JavaScript › A little Ajax+WordPress help needed
- This topic is empty.
-
AuthorPosts
-
January 3, 2013 at 1:56 am #41725bogusParticipant
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!
January 3, 2013 at 3:54 am #119695bogusParticipantwow 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?January 3, 2013 at 4:17 am #119697bogusParticipantjust 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 :(
January 3, 2013 at 6:11 am #119701bogusParticipantmhh. 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?
January 3, 2013 at 6:18 am #119702bogusParticipantthe code thing is broken somehow. I put the code on codepen [here](http://codepen.io/joe/pen/nhrsj “”).
January 3, 2013 at 8:19 am #119713bogusParticipantJanuary 3, 2013 at 8:21 am #119711bogusParticipantits the code from my mockup which you can see [here](http://tingeltangel.megavillain.org/ “”).
January 3, 2013 at 8:54 am #119708bogusParticipantugs, 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!
January 3, 2013 at 1:22 pm #119741bogusParticipantI 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.
January 4, 2013 at 2:50 am #119797bogusParticipantyay! thanks so much jamy!
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.