我想調用外部Web服務,其工作正常在鉻,但不是在Firefox和IE瀏覽器。在Chrome中,它返回'true'
,但在Firefox,它返回'0 error'
,在這裏是我的完整代碼...Web服務工作正常鉻,但不是在Firefox和IE瀏覽器
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#btnCall").click(function (event) {
var campaignid = 1000007;
var r_source_id = 1000008;
var parameters = "{'CompanyName': '" + document.getElementById('txtCompanyName').value + "', 'name': '" + document.getElementById('txtName').value + "', 'title': '', 'email':'" + document.getElementById('txtEmail').value + "', 'phone':'" + document.getElementById('txtPhoneNo').value + "', 'web_url':'', 'no_of_emp':'0', 'c_Currency_id':'100', 'r_source_id':'" + r_source_id.toString() + "', 'industry_ID':'1', 'city':'', 'country_ID':'" + document.getElementById('ddlCountry').value + "', 'cur_solution':'','pur_timeline':'','comments':'', 'year_sell_erp':'2013', 'support':'', 'bpgroup_ID':'1', 'C_Campaign_ID':'" + campaignid.toString() + "', 'R_STATUS_ID':'1000033', 'C_Region_ID':'100', 'CreatedBy':'1000012', 'salesrep_id':'1000012', 'ad_org_id':'1000001', 'ad_client_id':'1000001', 'UpdatedBy':'100', 'AccessKey':'caff4eb4fbd6273e37e8a325e19f0991'}";
$.ajax({
type: "POST",
url: "http://cloudservice.softwareonthecloud.com/service.asmx/SetLead",
data: parameters,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (msg) {
AjaxSucceeded(msg);
},
error: AjaxFailed
});
});
});
function AjaxSucceeded(result) {
alert(result.d);
}
function AjaxFailed(result) {
alert(result.status + ' ' + result.statusText);
}
</script>
這裏是我上傳這個功能URL for testing
你加載jQuery兩次? –
看起來好像您正在嘗試發出CORS請求。 jQuery不支持IE 10中的CORS請求,在你使用的舊版本的jQuery中,它可能在firefox中也不起作用。 –
有什麼解決方案/技巧,它可以在Firefox中工作嗎? –