Php 当我们使用post跨域发送数据时,Jquery成功方法不起作用
我正在尝试使用跨域jQueryajax请求登录。完成请求后我的成功方法不起作用Php 当我们使用post跨域发送数据时,Jquery成功方法不起作用,php,jquery,ajax,wordpress,cross-domain,Php,Jquery,Ajax,Wordpress,Cross Domain,我正在尝试使用跨域jQueryajax请求登录。完成请求后我的成功方法不起作用 jQuery("#loginButton").click(function(e){ e.preventDefault(); jQuery.ajax({type: "POST", dataType: "json", crossDomain: true, xhrFields: { withCredentials: true
jQuery("#loginButton").click(function(e){
e.preventDefault();
jQuery.ajax({type: "POST",
dataType: "json",
crossDomain: true,
xhrFields: {
withCredentials: true
},
url: "http://example.com/wp-admin/admin-ajax.php?action=login",
data: {
log: jQuery("#username").val(), pwd: jQuery("#password").val(),remember: false, },
success:function(result){
console.log(result);
}
});
});
您在浏览器的控制台中看到了什么?我在控制台日志中收到响应,但在succees函数中未显示警报或任何响应。我还在php代码中设置了访问控制允许源站阻止跨源请求:同一源站策略不允许读取远程资源。(原因:缺少CORS标头“访问控制允许来源”