Search code examples
sessionvue.jssession-cookiesvue-resource

Uploading multiple image to server without accessing same session with two ajax call simultaneously ?


I am trying to upload multiple image using ajax call, but when two ajax call request same session, its , my login get logs out, so I am trying to upload it in synchronous way using ajax. How i should upload it with ajax with making async


Solution

  • Chrome: 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/.

    Since Synchronous XMLHttpRequest is deprecated in Chrome and Firefox, you can do something that feels synchronous like this:

    async function sendRequest() {
        let response = await this.$http.get('/someUrl')
        console.log(response.body)
    }