phonegap plugins - cordova: deviceready not firing -
i trying create login page using ajax validate data. working fine if use document ready when used document.addeventlistener("deviceready", ondeviceready, false);
not firing ajax.
here code have @ moment.
<script type="text/javascript"> document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { //$('document').ready(function() //{ $("#login").on("submit", function(e) { alert('test'); ajax code goes here }); }; </script>
this code inside foot section. have included cordava.js in head section.
please advise doing wrong.
wrap code in -
$( document ).ready(function() { //here code document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { $("#login").on("submit", function(e) { alert('test'); }); }; });
sometimes document needed ready, required files downloaded fire or attach event handler.
Comments
Post a Comment