javascript - make an ajax call in the very first page in JQM -



javascript - make an ajax call in the very first page in JQM -

i trying show popup in first page if php post returns json file data.

i tried with:

$(document).on("pageinit", '#home', function() { ajax phone call async:false,...

and after that, fill element list elements if json has data:

if(userlastpush == 1){ var getpushxdays = '{"day":"4"}'; $.ajax({ type: "post", url: urlserver+"getpushxdays.php", data: getpushxdays, async: false, contenttype: "application/json; charset=utf-8", datatype: "json", success: function(response) { //console.log(response); html = ''; if(response.message != "empty"){ jquery.each(response, function(category, val) { if(val.id_event == 0){ html +='<li><a href="#mymessagesall" data-transition="slide">' + val.message + '</a></li>'; }else{ html +='<li><a href="#mymessagesevent" data-transition="slide">' + val.message + '</a></li>'; } }); } $(".popuppush").append(html).listview('refresh'); if(checkpushing == 0){ $("#checkpush").trigger("click"); } }, error: function(xhr, status, message) {} }); }

but works sometimes. others, ajax never ends or never shows data. tried using function instead , function called no homecoming ajax. there way create getting info before page load?

javascript jquery ajax jquery-mobile

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -