Rewrite jquery ajax request in axios and set xhrFields

泪湿孤枕 提交于 2019-12-10 23:57:46

问题


i HAVE jquery request

$.ajax({
    type: "GET",
    url: "http://6232423.212342343.100.89:9000/api/v2/content/categories/",
    xhrFields: {
        withCredentials: true
    },
});

how do I make the same but in axios? I tried like this:

axios.get(portal.categoriesUrl,
          {xhrFields: {
        withCredentials: true
    }}
)

but didn't work


回答1:


axios.get(url, { withCredentials: true })

see docs https://github.com/mzabriskie/axios



来源:https://stackoverflow.com/questions/45589448/rewrite-jquery-ajax-request-in-axios-and-set-xhrfields

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!