我想使用 jQuery ajax 方法来验证登录,Web 服务是由第三方通过 https POST 方法提供的。
我使用以下代码,但它不起作用。
$.ajax({
type: "POST",
dataType: 'json',
contentType:'application/json',
url: "https://salesforce login web service",
crossDomain:true,
data: {un:"bohan",pw:"123456"},
success: function(data) {
alert('success!'); // or not!
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status+" : "+thrownError); // 0
}
});
我认为这可能是由 AJAX 跨域相关问题引起的。我该怎么办?谁能给我一些建议?太感谢了。