Better compatible with jQuery Mobile 1.4+. Replaced dialog with popup for error alert. Updated demo.