[英]esponse to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin'
hi i am using jquery ajax method to get accces to login token but getting this message 嗨,我正在使用jquery ajax方法获取访问登录令牌的权限,但收到此消息
Failed to load https://login.salesforce.com/services/Soap/u/42.0?wsdl : Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
无法加载https://login.salesforce.com/services/Soap/u/42.0?wsdl :对预检请求的响应未通过访问控制检查:上没有'Access-Control-Allow-Origin'标头要求的资源。 Origin ' https://www.example.com
来源' https://www.example.com
$(document).ready(function(){
//alert('blnk');
$.ajax({
headers: {
"Accept" :'application/json' //If your header name has spaces or any other char not appropriate
},
url: 'https://login.salesforce.com/services/Soap/u/42.0?wsdl',
contentType: "application/json; charset=utf-8",
type: 'post',dataType: "post",data:JSON.stringify( {username :'demo', password :'demo'}),
crossDomain: true,
success: function(resuklt){
console.log(resuklt);
}});
[enter image description here][1]
});
Please use ... 请用 ...
dataType: 'jsonp', //use jsonp data type in order to perform cross domain ajax
crossDomain: true,
before succes function.. 成功之前的功能..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.