Javascript-ajax asynchronous request data, ios screen flashing

Source: Internet
Author: User
When ajax asynchronously requests data on a chat page, no matter whether data is returned or not, ios will flash, but android will not flash. what is the problem and how to solve it? {code ...} when ajax asynchronously requests data on a chat page, no matter whether data is returned or not, ios will flash, but android will not flash. what is the problem and how to solve it?

$ (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) {// normal text or image str ='
  • '+ Array ['uname'] +'

    '+ Array ['Time'] +'

    '+ Array ['content'] +'

    Delete

  • ';} Else {// My dashboard str ='
  • '+ Array ['uname'] +'

    '+ Array ['Time'] +'

    Duplicate Kingdom screen '+ arr [array ['type'] +' second'+ Array ['content']; if (array ['IMG']! = "") {Str + = '';} str + ='

    Delete

  • ';}} Else {if (array ['type'] = 0) {// normal text or image str ='
  • '+ Array ['uname'] +'

    '+ Array ['Time'] +'

    '+ Array ["content"] +'

    '; If (isadmin) {str + ='

    Delete

    Pull Black

    ';} Str + ='

  • ';} Else {// others' screen str ='
  • '+ Array ['uname'] +'

    '+ Array ['Time'] +'

    Duplicate Kingdom screen '+ arr [array ['type'] +' second'+ Array ['content']; if (array ['IMG']! = "") {Str + = '';} str + ='

    '; If (isadmin) {str + ='

    Delete

    Pull Black

    ';} Str + ='

  • '; }}$ (". Main_box ul "). append (str); $ ('. main_box '). scrollTop ($ ('. main_box ') [0]. scrollHeight );});}});}

    Reply content:

    When ajax asynchronously requests data on a chat page, no matter whether data is returned or not, ios will flash, but android will not flash. what is the problem and how to solve it?

    $ (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) {// normal text or image str ='
  • '+ Array ['uname'] +'

    '+ Array ['Time'] +'

    '+ Array ['content'] +'

    Delete

  • ';} Else {// My dashboard str ='
  • '+ Array ['uname'] +'

    '+ Array ['Time'] +'

    Duplicate Kingdom screen '+ arr [array ['type'] +' second'+ Array ['content']; if (array ['IMG']! = "") {Str + = '';} str + ='

    Delete

  • ';}} Else {if (array ['type'] = 0) {// normal text or image str ='
  • '+ Array ['uname'] +'

    '+ Array ['Time'] +'

    '+ Array ["content"] +'

    '; If (isadmin) {str + ='

    Delete

    Pull Black

    ';} Str + ='

  • ';} Else {// others' screen str ='
  • '+ Array ['uname'] +'

    '+ Array ['Time'] +'

    Duplicate Kingdom screen '+ arr [array ['type'] +' second'+ Array ['content']; if (array ['IMG']! = "") {Str + = '';} str + ='

    '; If (isadmin) {str + ='

    Delete

    Pull Black

    ';} Str + ='

  • '; }}$ (". Main_box ul "). append (str); $ ('. main_box '). scrollTop ($ ('. main_box ') [0]. scrollHeight );});}});}

    Flashing is to refresh the page and check whether there is code for re-rendering the page.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.