Make a chat page, Ajax asynchronous request data, regardless of whether there is no data return, iOS will flash a bit, and Android will not flash, this is how to solve
$ (document). Ready (function () {$ ('. Loading_box '). attr (' style ', ' display:none '); Ajaxform (); Window.setinterval ("Ajaxform ()", 3000); }); function Ajaxform () {var id=$ (". Main_box ul Li:last-child"). Find ('. delete_btn '). attr (' field ');//alert (ID); $.post ("{: U (' App/friends/ajaxform ')}", {"OpenID": OpenID, "id": id}, function (data) {if (data) {var str = ""; Console.log (data); $.each (data, function (index, array) {if (array[' OpenID ']==openid) {if (array[' type ']==0) { Plain text or picture str= '' +array[' uname ']+ '
' +array[' time ']+ '
' +array[' content ']+ '
Delete'; }else{//My PA screen str= '' +array[' uname ']+ '
' +array[' time ']+ '
A hefty splash screen ' +arr[array[' type ']]+ ' s ' +array[' content '; if (array[' img ']!= "") {str+= '; } str+= '
Delete'; }}else{if (array[' type ']==0) {//plain text or picture str = '' +array[' uname ']+ '
' +array[' time ']+ '
' +array[' content "]+ '
'; if (isadmin) {str+= ' remove pull black '; } str+= ''; }else{//Others PA screen str= '' +array[' uname ']+ '
' +array[' time ']+ '
A hefty splash screen ' +arr[array[' type ']]+ ' s ' +array[' content '; if (array[' img ']!= "") {str+= '; } str+= '
'; if (isadmin) {str+= ' remove pull black '; } str+= ''; }} $ (". Main_box ul"). Append (str); $ ('. Main_box '). ScrollTop ($ ('. Main_box ') [0].scrollheight]; }); } } );}
Reply content:
Make a chat page, Ajax asynchronous request data, regardless of whether there is no data return, iOS will flash a bit, and Android will not flash, this is how to solve
$ (document). Ready (function () {$ ('. Loading_box '). attr (' style ', ' display:none '); Ajaxform (); Window.setinterval ("Ajaxform ()", 3000); }); function Ajaxform () {var id=$ (". Main_box ul Li:last-child"). Find ('. delete_btn '). attr (' field ');//alert (ID); $.post ("{: U (' App/friends/ajaxform ')}", {"OpenID": OpenID, "id": id}, function (data) {if (data) {var str = ""; Console.log (data); $.each (data, function (index, array) {if (array[' OpenID ']==openid) {if (array[' type ']==0) { Plain text or picture str= '' +array[' uname ']+ '
' +array[' time ']+ '
' +array[' content ']+ '
Delete'; }else{//My PA screen str= '' +array[' uname ']+ '
' +array[' time ']+ '
A hefty splash screen ' +arr[array[' type ']]+ ' s ' +array[' content '; if (array[' img ']!= "") {str+= '; } str+= '
Delete'; }}else{if (array[' type ']==0) {//plain text or picture str = '' +array[' uname ']+ '
' +array[' time ']+ '
' +array[' content "]+ '
'; if (isadmin) {str+= ' remove pull black '; } str+= ''; }else{//Others PA screen str= '' +array[' uname ']+ '
' +array[' time ']+ '
A hefty splash screen ' +arr[array[' type ']]+ ' s ' +array[' content '; if (array[' img ']!= "") {str+= '; } str+= '
'; if (isadmin) {str+= ' remove pull black '; } str+= ''; }} $ (". Main_box ul"). Append (str); $ ('. Main_box '). ScrollTop ($ ('. Main_box ') [0].scrollheight]; }); } } );}
Flashing is the page refresh, see if there is a re-render the page code.