Reputation: 305
I am using a simple html button to submit the data.I am using codeigniter framework.The following code is my button for cacel the page and go back to the previous page.
<input type="button" value="Cancel" onclick="" class="cancel_button">
When I click the cancel button it should go to the following url
http://localhost/sample/categorycontroller/index
Please let me know,how to pass the url through the button.?
Thanks in advance
Upvotes: 0
Views: 5616
Reputation: 3589
<input type="button" value="Cancel" onclick="goBack()" class="cancel_button">
Then create a Javascript function called goBack()
<script type="text/javascript">
function goBack() {
window.location = 'http://localhost/sample/categorycontroller/index';
}
</script>
Upvotes: 0
Reputation: 438
Please user this :
<input type="button" value="Cancel" onclick="window.location.href = 'http://localhost/sample/categorycontroller/index'" class="cancel_button">
Upvotes: 0
Reputation: 394
Try this:
<input type="button" value="Cancel" onclick="window.location = 'http://localhost/sample/categorycontroller/index'" class="cancel_button">
Upvotes: 2