Ajax请求跨域问题,报错XMLHttpRequest cannot load ''. No 'Access-Control-Allow-Origin' header is present on t
来源:互联网 发布:飞升阵法数据 编辑:程序博客网 时间:2024/06/04 18:57
报错:XMLHttpRequest cannot load ''. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' ' is therefore not allowed access.
原因:ajax默认不支持跨域访问,相应解决这问题很简单,加上dataType: 'JSONP'就可以完美解决
$.ajax({
type: "GET",
dataType: 'JSONP',
url: 'http://'+element.vm.ip+':8034/Monitor/StartMonitorMachine',
data: {
"configId": stdetailsvm.monitorConfigList[i].id,
"itemId": itemId,
"startTime": stdetailsvm.currentTime(),
"ip":element.vm.ip
},
success: function (data) {
if (data.Data == "0") {
} else {
alert("向服务器发送监控指令失败。"+data.Message);
}
},
error: function (data) {
alert(data.retMSG);
}
});
- Ajax请求跨域问题,报错XMLHttpRequest cannot load ''. No 'Access-Control-Allow-Origin' header is present on t
- XMLHttpRequest cannot load http://XXXx.json. No 'Access-Control-Allow-Origin' header is present on t
- ajax跨域请求:No 'Access-Control-Allow-Origin' header is present on the requested resource
- No 'Access-Control-Allow-Origin' header is present on the requested resource.ajax跨域请求
- xmlhttprequest cannot load No 'Access-Control-Allow-Origin' AJAX跨域请求解决方法
- 跨域问题:No 'Access-Control-Allow-Origin' header is present on the requested resource.
- 跨域问题:“No 'Access-Control-Allow-Origin' header is present on the requested resource”
- No 'Access-Control-Allow-Origin' header is present on the requested resource. 报错解决。
- XMLHttpRequest cannot load httplocalhost8090xuexipoccharge. No 'Access-Control-Allow-Origin' header
- AJAX跨越、JS跨越请求 No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin
- 关于springmvc跨域请求 No 'Access-Control-Allow-Origin' header is present on the requested resource.
- 本地Ajax跨域访问 No 'Access-Control-Allow-Origin' header is present on the requested resource.
- No 'Access-Control-Allow-Origin' header is present on the requested resource.'Ajax跨域访问解决方案
- No 'Access-Control-Allow-Origin' header is present on the requested resource.'Ajax跨域访问解决方案
- No 'Access-Control-Allow-Origin' header is present on the requested resource.'Ajax跨域访问解决方案
- (转)No 'Access-Control-Allow-Origin' header is present on the requested resource.'Ajax跨域访问解决方案
- js跨域访问,No ‘Access-Control-Allow-Origin‘ header is present on
- js跨域访问,No ‘Access-Control-Allow-Origin‘ header is present on
- JAVA虚拟机优化实战
- Android 自定义ProgressDialog
- iOS 将系统音乐库的文件缓存到沙河路径并上传服务器
- Java笔记-String类
- 将整数以字符串的形式逆序输出
- Ajax请求跨域问题,报错XMLHttpRequest cannot load ''. No 'Access-Control-Allow-Origin' header is present on t
- 微信登录
- Apache Shiro 整合Spring 进行权限验证 以及在Freemarker中使用shiro标签
- Robotium学习(二)
- Spring destroy-method="close"的作用
- websocket autobahn jar包的用法
- 用户登录过滤器
- Git常用命令总结
- Vue.js初步入门