JQuery to load content in a div

Hi I would like to load an html page in a div using

$(document).ready(function() {
    $("#popupContent").load("aeffect.html");

    //Close property
$("a.close").click(function(){
        $("#popupContainer").empty();

        });
});

      

My html from the calling page:

<div id="popupContent"></div>

      

What I would like to do is when aeffect.html

loaded into the div that it also writes the code from aeffect.html

into the body of the calling page so that the final result on the calling page will read like this

<div id="popupContent">
    <div class="projectPopup" id="aeffect">
    <a class="close">Close &times;</a>
    <img src="/img/aeffect_popup.jpg" width="500" height="729" alt="" />
    <p class="description">Description</p></div>
</div>

      

My problem is due to the fact that I am trying to delete aeffect.html

after the user clicks close

. I thought that I could just fire up the DIV, but there is nothing to put in ...

+2


source to share


1 answer


(The closing div is missing on #aeffect in my opinion).

$('#popupContent').load('page.htm #aeffect')

      

The first selector is the target container. The load method takes a page followed by a selector on the page you want.



I'm not sure about loading pages from other sites.

Let me know if this works for you. Scott

Check out the jQuery documentation for fine tuning. You can pass parameters to the page if it's a post and you can use a callback to fill the div for a smoother experience.

+2


source







All Articles