Forums

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

Home Forums JavaScript jquery/ajax and multipl div’s

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #25069
    nanook
    Member

    Morning all,

    I’m trying to incorporate jquery and ajax into my site to make the content as dynamic as possible. When a user clicks on the menu I have jquery/ajax updating the page content. I have images located in the div on the right that match the content, however when I put in the jquery the images stays the same when you go from Home to About Us. What is the best solution to accomplish updating both div’s upon different menu selections? Thanks in advance! You can view this at http://dev.howsmykiddriving.org.

    Thanks,

    Tim

    #58684
    Rob MacKay
    Participant

    hey :)

    well currently you are only making the change while targeting the #content – now you need to do the same for the extra :) – but do it within the same click function, then it will trigger when you click… :)

    #58696
    nanook
    Member

    Thanks Rob!! It work perfect! For anyone else that’s learning jquery this is what I did. Thanks again Rob!

    <script type="text/javascript">
    $(function(){
    $(‘li a’).click(function(){
    id=$(this).attr(‘id’);
    $("#content").load("pages.php?o="+id+"");
    return false;
    });
    $(‘li a’).click(function(){
    id=$(this).attr(‘id’);
    $("#extra").load("images.php?o="+id+"");
    return false;
    });
    });

    #59021
    Mr KiTT3N
    Member
    Code:

    why not just do both ajax calls at the same time rather than making javascript search and find the 'li a' twice and asigning the values (ect....)

    like so

    Code:
    #65444
    outrightent
    Member

    Ok, this really should not be that difficult but I am trying to use this code in order to display two (more once I figure this out) .txt files stored on my server. Someone please help me I think I might just shoot myself…every time I click either it just displays the filmone.txt. I know there has got to be something simple I am missing.

    Code:

    THANKS!!!

    #65485
    Rob MacKay
    Participant

    Hey no probs – glad I helped it click… Jquery is great :)

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