Grow your CSS skills. Land your dream job.

Remove and load

  • # December 14, 2012 at 10:38 am

    There you go folks…I’m no JS / AJAX expert (or even a novice) but that’s what he’s after.

    Over to you.

    # December 14, 2012 at 10:40 am

    Thank you both for clear that out.

    # December 14, 2012 at 10:41 am

    I assume I’ve got your point there. $.load() should be what you are looking for.

    [jQuery API – $.load](http://api.jquery.com/load/)

    Also, check out this screen cast from chris:
    [ AJAXing a WordPress theme](http://css-tricks.com/video-screencasts/81-ajaxing-a-wordpress-theme/)

    Just register on the tab-button click event and load the content from another URL.

    # December 14, 2012 at 10:50 am

    So it’s not possible to use the load or any other javascript/jquery function to load code, it that it? It always have to be from an external url.

    # December 14, 2012 at 10:52 am

    Yeah basically. Unless you use Javascript to deploy the code in the page. So basically doing an append/prepend on a particular element with code that’s only present in the javascript.

    # December 14, 2012 at 10:57 am

    Like this, http://codepen.io/andyunleashed/pen/gEJdf

    # December 14, 2012 at 10:58 am

    Oh, and you should be aware that your content won’t be visible to SEO bots unless it’s in a permitted subdirectory.

    # December 14, 2012 at 11:00 am

    Ok, that’s a start. So I can get the HTML code with get() and when the click occurs I can use append() to insert it. I just need a function to remove HTML to achieve what I want.

    # December 14, 2012 at 11:01 am

    I think remove() will do it

    # December 14, 2012 at 11:01 am

    Is there a way to have a callback when the stuff inserted with append finishes loading?

Viewing 10 posts - 16 through 25 (of 25 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".