I am trying to use jQuery Mobile 1.3.1's popup to warn the user when login credentials are false. I started with a basic template from jquerymobile's documentation, but I couldn't make it work with $('#popupBasic').popup('open');
If I use it this way;
<div data-role="page">
<div data-role="header" data-tap-toggle="false">
</div><!-- /header -->
<div data-role="content">
<a href="#popupBasic" data-rel="popup">Tooltip</a>
<div data-role="popup" id="popupBasic">I will change this text dynamically if this popup works</div>
</div><!-- /content -->
</div><!-- /page -->
It works well when I click on the Tooltip link. But in my case there isn't any click so I am trying this;
if(retVal){
$.mobile.changePage('index');
}
else{
$('#popupBasic').popup();
$('#popupBasic').popup("open");
}
this is after my ajax login function makes a callback, so retVal is true if there isn't any errors, false if there is (and at that point I am trying to show popup). By the way all my js part is in
$(document).on('pageinit', function(){});
so i wait till jquerymobile is ready for the page.
What happens when I do this is on desktop browsers link changes as
http://localhost/login#&ui-state=dialog
but doesn't show the pop up. After some refreshes and caches it starts to show. On iOS same thing also happens but on android sometimes it changes link some time it doesn't.
I would be really happy if someone can help me to solve this problem. Thanks in advance.