I've a very simple question, but I can't find the correct way to resolve. I have a phonegap app which has a login, and I check the results with ajax. I check the form when the user clicks:
<a href="home.html" data-transition="pop">GO</a>
The order of the instructions are:
I can't do a
window.location.replace('index.html');
because I lost the data-transition.
Another option could be make a link hidden, and trigger its click when necessary, but I don't like it.
The best way it's when click at Go, do something, and if it's necessary go to its href.
Thanks for all!
$("a").click(function(e){
// Do what all checks you need to do here
if(something is wrong)
{
// Do stuff here
e.preventDefault(); // Stop propagation of default event.
return false;
}
});
This way the data-transition will also work, becaue the default event will be stopped only when the validation fails.