How do I redirect the user to another page withing the same website?
In my case, I have a form where a user fills in some information. so, for cancellation they should have options. When a user hits that button, he/she will get a dialog box. If hits ok, they will be redirected to the index page.
I don’t want the user to see the address of my website. Why? I developed an android app where I managed to hide the address bar of my browser.
I’m using Jquery Mobile in this case. I have already written something like this in JavaScript but I still have the problem with the address showing up in the dialog box. I was told I could do this in Jquery, so I started to learn it. Cancel button:
<div data-role="fieldcontain">
<button data-theme="b" id="canc" onclick="cancelMe()" dataicon="delete">cancel</button>
</div>
Here’s my JavaScript:
<script>
function cancelMe() {
var answer = confirm("Are You sure?")
if (answer){
alert("No information saved!")
window.location = "http://www.stackovrflow.com";
}
else{
alert("You may hit save to submit information")
}
}
</script>
And I started Jquery here, but I’m not sure yet:
$(document).delegate('#canc', 'click', function() {
$(this).simpledialog({
'mode' : 'string',
'prompt' : 'Are you sure?',
'buttons' : {
'OK': {
click: function () {
// Here's the issue
window.location.href = 'http://www.stackovrflow.com';
}
},
'Cancel': {
click: function () { },
icon: "delete",
theme: "b"
}
}
})
})
I know this could be done in Ajax somehow, but don’t know how? I might have to know a little about Ajax. If you know any other way of doing this, please enlighten me.
Thanks,
YahyaOtaif
you cannot change the title of the confirm dialog. the only way is simulate the confirmation box. this is a good article how to do it using jQuery