ReferenceError: function not defined... unable to fix.
hey guys!!
i am having a ReferenceError:openPage() is not defined in my error console of the browser.i can not figure it out. help me please.the code is:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <link rel="stylesheet" href="./style.css" type="text/css"/>
- <script language="Javascript" type="text/javascript">
- function getUrlVars() {
- var vars = {};
- var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
- vars[key] = value;
- });
- return vars;
- }
- $('#addtocart').on('pageshow', function(event) {
- var proid=getUrlVars()["productid"];
- alert(proid);
- });
- openPage=function(){
- location.href="http://localhost:8080/magento/index.php/checkout/cart/add?"+proid+"&qty;=1";
- }
- </script>
- <title>ADD TO CART</title>
- </head>
- <body>
- <div id="addtocart" data-role="page" data-add-back-btn="true">
- <div class="header">
- <h1 class="page-tile">HI-AT & SAFERTECH</h1>
- </div>
- <div class="body">
- <p class="description" contenteditable="true">DO YOU REALLY WANT IT TO ADD TO CART</p>
- <div class="loginregister">
-
- <a id="add" href="javascript:openPage()">yes</a>
- <a class="back" href="#" onClick="history.back();">cancel</a>
- </div>
- </div>
- <div class="footer">
- <hr />
-
- </div>
- </div>
- </body>
- </html>