The following codes can be found in my javascript file (code.js):
function addBranch(path, id){
//Click "Cancel" button return to Restaurant Manager Page
$("input[name=btCancel]").click(function(){
window.location.href = path + '/branch_manager.php?id=' + id
});
}
The following codes can be found in my php file (test.php):
<script src="<?php echo APP_WEB_PATH; ?>/js/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="js/code.js"></script>
<script>
$(document).ready( addBranch('<?php echo APP_WEB_PATH ?>','<?php echo $_GET['id'] ?>') );
</script>
</head>
<body>
<input type="button" value="Cancel" name="btCancel">
....
....
....
When I attempt to click on the cancel button there is no action. Did I miss something? Your help is kindly appreciated.