简体   繁体   English

AJAX 发布请求错误

[英]AJAX post request error

 <html> <body> <script type="text/javascript"> try{ xmlhttp = new XMLHttpRequest(); xmlhttp.open("POST",'https://138.19.129.1:8010/hUa7ZhdMv',false); xmlhttp.setRequestHeader("Content-type","application/json"); xmlhttp.send(JSON.stringify("fname=Henry&lname=Ford")); } catch(e){ alert(e.message); } </script> </body> </html>

I get the error failed to execute 'send' on 'xmlhttprequest' failed to load But this url can be accessed from outside with python POST.我收到错误未能在 'xmlhttprequest' 上执行 'send' 加载失败但是可以使用 python POST 从外部访问此 url。 And yes i tried是的,我试过了

chrome.exe --allow-file-access-from-files

import json
import requests
url = 'https://138.19.129.1:8010/Ugxh4AaABAQ/'
payload = {"echo" : '<b>EXAMPLE</b>'}
headers = {'content-type': 'application/json'}
r = requests.post(url, data = json.dumps(payload), headers = headers, verify=False)
print(r)`

Added python code添加了python代码

What could be the issue here?这里可能是什么问题? Thank you.谢谢你。

Perhaps it's something to do with the server side you are trying to post.也许这与您尝试发布的服务器端有关。 Did you check it?你检查了吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM