阿贾克斯不工作在iPad [英] ajax not working on ipad
问题描述
我有一个表格:
<form id="orderForm" onsubmit="return prepareOrder(this);" action='@ConfigurationManager.AppSettings["EpayLogonUrl"]' method="POST">
<input type="hidden" name="Signed_Order_B64" value="">
<input type="hidden" name="email" size="50" maxlength="50" value="@Model.Email">
<input type="hidden" name="appendix" value="@Model.AppendixInfo">
<button class="wiz_button" type="submit" disabled="disabled">
<span><span id="buy_button_name">Buy</span></span></button>
</form>
和函数prepareOrder
and a function PrepareOrder
function prepareOrder(form) {
var selectedPayWay = $('.pay_cont.selected').data('way');
var result;
$.ajax({
type: 'POST',
url: '/Pay/CreateOrder',
data: { payWay: selectedPayWay },
success: function (response) {
if (response.IsSuccess) {
switch (selectedPayWay) {
case payWay.Terminal:
showBookingInfo(response.BookingId, response.ExpiredDate);
result = false;
break;
case payWay.Epay:
$("input[type=hidden][name=Signed_Order_B64]").val(response.SignedString);
$("input[type=hidden][name=appendix]").val(response.AppendixString);
result = true;
break;
}
} else {
toastr.options.timeOut = 10000;
toastr.info(response.Message);
result = false;
}
},
error: function () {
result = false;
},
async: false
});
return result;
}
的问题是,在一个新的iPad(Safari浏览器) CreateOrder
动作不叫。在桌面浏览器,它工作正常。有在控制台没有错误。我尝试添加一个通知后:
The problem is that on a new ipad (Safari) CreateOrder
action is not called. On the desktop browser, it works fine. There are no errors in console. I tried to add an alert after:
success: function (response) {
这样的:
success: function (response) {
alert(response.IsSuccess)
和警告
返回我真
。为什么?如果 CreateOrder
不叫。我还添加记录到 CreateOrder
的行动,也没有输出字符串。
and alert
return me true
. Why? if CreateOrder
is not called. I also added logging to CreateOrder
action and there are no output strings.
推荐答案
Safari和/或iPad支持非常强大的缓存。我曾在我的应用程序相同的问题了。尝试添加以下属性到控制器(甚至基本控制器):
Safari and/or Ipad support a very strong caching. I had the same problem in my application, too. Try adding following attributes to your controller (or even base controller):
[OutputCache(NoStore = true, Duration = 0)]
这篇关于阿贾克斯不工作在iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!