jquery .load() after page call function

JisubKim

I am using function to jQuery .load(). I want to execute function(testFnc) of after page. This function is onclick event.

And I want using variable of b.aspx.

This is the code:

//a.aspx page code
$('#divArea').load('b.aspx');

//b.aaspx page code
function testFnc() {
 //code
}
...

edit code :

//a.aspx page code
$('#divArea').load('b.aspx');

//b.aaspx page code
function testFnc(param) {
//code
}
...
<span onclick='testFnc(params);'>button</span>
Kiran Shahi

Use the callback for on load() method. Callback function executed when load load() execution completes.

<span id="loadb">button</span>

$("#loadb").on('click', function(){
    $('#mydiv').load('b.aspx', function() {
        // This gets executed when the content is loaded
        testFnc()
    });

    function testFnc() {
        //code
    }
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related