Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2012
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post

    How to change content in jQuery without loading a new page?

    Image below is what I want it to do. I want to click on the tab on the left and instead of loading the page to a new page. I would like it to change in that one DIV. I know you can do that in jQuery but don't know where to look for it because I don't know the right word they use to do this.

    Can you post a link of an example of this or a how to?


  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    Specifically this is more Ajax and less jQuery. Ajax is a Javascript technique that helps you avoid to refresh the whole page.

    Basically there's the XMLHttpRequest object that can "call" a server side script and receive the output of this script as a result. This output can then be "incorporated" into the current page (whereever you want).

    Truth be told, you can of course also start Ajax requests with jQuery. Take a look at $.ajax(), $.get() and $.post()

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,474
    Thanks
    6
    Thanked 980 Times in 953 Posts
    And one important thing in advance to consider: Don’t make your website rely on this. You have to have your site working without JS at first, i. e. have regular pages that are loaded upon clicking the navigation links. Only after you have made sure your website is usable and accessible without JS you should add this kind of functionality as enhancement.

    Speaking of enhancement: The functionality you are asking for is not an enhancement if you interfere with the custom user interaction. Specifically you have to make sure the browser’s back and forward buttons are working as expected and ideally that the browsing history is recorded properly. Also, you have to make sure that people can set a bookmark to a specific page/content.

    All in all, if you ponder this intensively you will come to the conclusion that what you are currently looking for is not an enhancement at all, it’s merely a superfluous straining after effect. You would have to jump through hoops for something that barely brings any advantage to the user. So think again!

  • #4
    New Coder
    Join Date
    May 2012
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks for your input. I will not do this. I will just make a new page for it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •