我无法让AJAX在IE9及更早版本中运行。它适用于包括IE10在内的所有其他浏览器,但仅在IE9及更早版本中提供失败响应。我已经尝试了通过几个小时的谷歌搜索建议的所有解决方案,但没有一个有效。
我的表格是kurbo.com/purchase_total.php
以下是在IE9或更早版本中无效的代码:
$.ajax({
url: "https://my.kurbo.com/api/v1/coupons/"+code,
type: 'GET',
dataType: 'json',
async:false,
success: function( data ) {
obj = data;
if (!obj.error){
$('input[name="coupon"]').val(obj.data.code);
$('#display-coupon').html(obj.data.description);
var date = new Date();
date.setTime(date.getTime()+(30*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
// document.cookie = 'coupon_shown='+obj.data.code+expires+';';
//(Turns off cookie for the coupon shown)
mixpanel.track("Physician Code Applied", {
"plan": plan_id,
"coupon": obj.data.code,
"flag" : flag,
"timestamp" : timestamp
});
if (obj.data.percent_off!=null){
var discount=obj.data.percent_off*.01*plan_info[plan_id][2];
$('#display-discount').html("- $"+discount.toFixed(2));
var new_total=plan_info[plan_id][2]-discount;
$('#total-cost').html("$"+new_total.toFixed(2));
$('input[name=amount]').val(new_total.toFixed(2));
}else{
var discount=obj.data.amount_off;
$('#display-discount').html("- $"+discount.toFixed(2));
var new_total=plan_info[plan_id][2]-discount;
$('#display-coupon').html('');
$('#total-cost').html("$"+new_total.toFixed(2));
$('input[name=amount]').val(new_total.toFixed(2));
}
}else{
$('.coupon-container').prepend('<div class="err_msg">We\'re sorry, but that Physician Code is not currently valid.</div>');
//remove any existing code if the user enters a bad one
$('input[name="coupon"]').val("");
$('#display-coupon').html("");
$('#display-discount').html("");
var new_total=plan_info[plan_id][2];
$('#total-cost').html("$"+new_total.toFixed(2));
$('input[name=amount]').val(new_total.toFixed(2));
window.coupon_code="";//kill code
}
},
error: function( response ) {
$('.coupon-container').prepend('<div class="err_msg">We\'re sorry, but that Physician Code is not currently valid.</div>');
//remove any existing code if the user enters a bad one
$('input[name="coupon"]').val("");
$('#display-coupon').html("");
$('#display-discount').html("");
var new_total=plan_info[plan_id][2];
$('#total-cost').html("$"+new_total.toFixed(2));
$('input[name=amount]').val(new_total.toFixed(2));
window.coupon_code="";//kill code
}
});