Home  >  Q&A  >  body text

javascript - The vue project uses an ajax synchronization request so that the operation and maintenance personnel can modify the background service address after packaging, but chrome gave a warning⚠️

1. The vue project uses ajax synchronization request in order for the operation and maintenance personnel to modify the background service address after packaging, but chrome gave a warning⚠️

  1. The root directory of my project can be requested and then spliced ​​with the corresponding address.

    let baseUrl
    import { Ajax } from './components/commonjs/ajax.js'
    Ajax.get('./static/baseApi.json', function (res) {
    let jsonRes = JSON.parse(res)
    console.log('Requested content:', jsonRes.baseUrl)
    baseUrl = jsonRes.baseUrl
    tempstaticUrl = jsonRes.staticUrl
    tempmodelLoadedUrl = jsonRes.modelLoadedUrl
    })
    // let baseUrl = '/CpyService'
    console.log('The background address currently being accessed is: ', baseUrl)
    export default {
    authCode: baseUrl '/ AuthImageCode/authCode'
    }

    1. But the chrome console gave a warning:
      ajax.js?4a26:6 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience . For more help, check https://xhr.spec.whatwg.org/.

淡淡烟草味淡淡烟草味2711 days ago1087

reply all(2)I'll reply

  • 为情所困

    为情所困2017-05-17 09:59:30

    This warning means that you are using ajax with async=false. It has nothing to do with your packaging or anything else

    reply
    0
  • ringa_lee

    ringa_lee2017-05-17 09:59:30

    Consider using jsonp? Data introduced using script tags,

    reply
    0
  • Cancelreply