0

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>
2
Contributors
1
Reply
7
Views
3 Years
Discussion Span
Last Post by urtrivedi
0

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

Edited by urtrivedi

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.