我正在使用Jquery Mobile和JSON Call开发一个网站,它显示了加载模型,但之后会转到空白页面。
我正在使用JQuery mobile 1.9.1
代码:
[HttpPost]
private ActionResult Accept(ProcessPaymentRequest request, string errorPage)
{
return Json(apiRequest, JsonRequestBehavior.AllowGet);
}
HMTL:
<div class="container" data-ajax="false">
<div class="modal hide automodal" id="processModal">
<div class="modal-body box-loading">
<div class="progress progress-striped active">
<div class="bar" style="width: 5%;"></div>
</div>
<h2>Please wait a while...</h2>
<p>We are processing your payment.</p>
</div>
<form action="" method="post" id="processForm123">
<input id="OneTwoThreeReq" name="OneTwoThreeReq" type="hidden" value="">
</form>
<form action="" method="post" id="newCCprocessForm">
<input name="paymentRequest" id="paymentRequest" type="hidden" value="">
</form>
<script type="text/javascript">
var interval = 5;
setInterval("loadProgress();", 1000); //every 2s
function loadProgress() {
if (interval >= 100) {
}
else {
interval += 5;
$('.bar').width(interval + '%');
}
}
</script>
</div>
我发现不是去了这个页面: 2C2PFrontend / UAT / TestClient的/的index.asp
它用这个html显示这个页面:
<head></head>
<body class="ui-mobile-viewport ui-overlay-c">
<div class="ui-page ui-body-c" data-role="page" data-url="/2C2PFrontend/UAT/PaymentV3UI/Payment/MAccept" tabindex="0" style="min-height: 634px;"></div>
<div class="overlay" style="display: block;"></div>
<div class="ui-loader ui-corner-all ui-body-a ui-loader-default"></div>
<div class="ui-page ui-body-c ui-page-active" data-role="page" data-url="/2C2PFrontend/UAT/TestClient/Index.aspx" data-external-page="true" tabindex="0" style="min-height: 284px;">
<div class="header"></div>
<div class="centered"></div>
</div>
</body>
请有人知道如何防止这种情况发生吗?
我在我用来调用它的函数中创建我自己的加载框,如上面和下面的HTML代码所示: function ShowLoadingDialog(){
//console.log("ShowLoadingDialog");
$('.bar').width("5%");
if (interval > 5) interval = 0;
if ($('.overlay').length == 0) {
$('body').append('<div class="overlay"></div>');
}
$('.overlay').show();
$("#loadingModal").toggle(100);
}
以下是我的AJAX电话
$.ajax({
type: "POST",
url: "Accept",
data: $('#credit_card_details_form').serialize(),
success: function (msg) {
if (msg.encrypted_payment_request != "") {
$("#newCCprocessForm #paymentRequest").val(msg.encrypted_payment_request);
$("#newCCprocessForm").attr('action', msg.processUrl);
$("#newCCprocessForm").submit();
} else {
//window.location.href = "Error?result=" + msg.result + "&result_desc=" + msg.result_desc;
window.location.href = "CCResult";
}
},
error: function () {
window.location.href = "Error";
它有点乱,因为我只是继续其他开发者留下的项目。