me have two projects now me want to call the function 0f one project an another project for example me have project A and B in A there are a javascript funtion which me want to call in project B on button click ...how it possible can any one explain are share any idea
projeca A function Code are below

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <script>
        function updateMyRentals()

        {

                alert("its Fine");
        }
    </script>
</head>

<body>
    <h2> Test Function </h2>
    <input type="button" onclick="updateMyRentals()" value="Call From Local Page" />
</body>
</html>

write your common function in one .js file

say you have written your javascript code in project a like

/webroot/projecta/js/myfuction.js

Now you want to access that same file in another projectb which is I assume that it is stored at same level. So you can include your main javascript file as follwoing

<script language="javascript" src='../projecta/js/myfunction.js'></script>

So now in your code page where you add above line, You can use the fuction and javascript variables declared in myfunction.js

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.