innerHTML works in IE and Firefox, but not Chrome

前端 未结 3 1785
[愿得一人]
[愿得一人] 2021-01-18 04:09

The data will not display in Chrome, unless i open an IE tab in Chrome go to the site then close it back to Chrome (sorry, if that doesn\'t make much sense).



        
3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-18 04:19

    I think you want to use:

    request.onreadystatechange = function() {
    

    instead of:

    request.onload = function() {
    

    And change the way you check the return value.

    See the asynchronous request code example here: https://developer.mozilla.org/en/DOM/XMLHttpRequest/Using_XMLHttpRequest for more details.

提交回复
热议问题