Serdar Şengül
Serdar Şengül

Reputation: 77

To run a function in another page

hello my english is not good , I hope you can understand me thank you

I got my 2 page , and I want to run the function on another page, but does not working In other pages function thank you

example

A PAGE

<head runat="server">
<script src="jquery-1.9.1.min.js"></script>
<script src="Apage.js"></script>

<script>
    $(document).ready(function () {
        AFunction();
    });
</script>

A PAGE IN FUNCTION

function AFunction() {

    $("#test").load("BPage.aspx");
    BFunction();

}

B PAGE

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BPage.aspx.cs" Inherits="pageb.BPage" %>


<script src="Bpage.js"></script>
 B PAGE LOADED..

B PAGE IN FUNCTION

function BFunction() {

        alert("Bfunction is working");


    }

test project http://speedy.sh/yajS5/pagea.rar

http://i.hizliresim.com/w1LkLN.png

Upvotes: 0

Views: 48

Answers (1)

Adil
Adil

Reputation: 148150

Call function in load callback of load() so that the function is available for being called.

function AFunction() {
    $("#test").load("BPage.aspx", function(){
            BFunction();
    });
}

Upvotes: 1

Related Questions