javascript - Framework7 onPageInit Not Working -


i have framework7 template. want call webservice when page load. code inside js file is:

myapp.onpageinit('cards', function (page){     myapp.alert('alert 1');             $.ajax({                 type: "post",                 url: "http://localhost:6032/api.svc/getticket/",                 data: json.stringify({unittype:1,unitnr:1,printertextnr:1,printernr:0,copies:1,logo:0,delay:0,host:'pc-pc',port:8899}),                 processdata: true,                 contenttype: "application/json; charset=utf-8",                 datatype: "json",                 success: function (data) {                     //get ticket                     var ticket = data.data.ticketnumber;                     document.getelementbyid('myticket').innerhtml = ticket;                     //end ticket                     document.getelementbyid('ticketbody').style.display = "block";                     alert(1);                 },                 error: function (xhr) {                     alert(xhr.responsetext);                 }             });      }).trigger(); 

but when page load doesn't nothing. when try script on html files, works fine. can me? thank you.

<!-- views -->   <div class="views">     <!-- main view -->     <div class="view view-main">       <!-- pages -->       <div class="pages">         <div class="page" data-page="cards">           <div class="page-content">             page content goes here           </div>         </div>       </div>     </div> 

make sure external page contains <div class="page" data-page="cards">


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -