这几天遇到了一个问题。。本地项目里,访问接口头,端口都固定了,导致我用WebSocket无法访问其他端口。。百度也没有心仪的结果,,,,嘿嘿嘿,最终还是让我找到了
var xhr = new XMLHttpRequest()
//Sets the request method, request URL, and synchronous flag.
xhr.open('get', 'http://127.0.0.1:8090/api/mess', true)
xhr.send()//发起请求
就这么简单,网上居然没有,,,收工!