【发布时间】:2021-03-29 10:49:44
【问题描述】:
let xhr = new XMLHttpRequest()
let data ={
"name": "test",
"phone": "12345678",
"email": "test@test.com",
"content": "i wish"
}
let dataStr = JSON.stringify(data)
xhr.open('post',apiUrl,true) // apiUrl is provided from back side
xhr.setRequestHeader('Content-type','application/json')
xhr.send(dataStr)
困扰了我几天,请帮帮我。
【问题讨论】:
-
连接被拒绝意味着在给定的 URL 上没有运行网络服务器。或者可能有防火墙阻止您连接到它。
标签: javascript ajax post