$ .ajax无法在ios设备(iphone)上运行

时间:2015-07-02 12:39:45

标签: javascript jquery ios iphone ajax

点击按钮我正在调用一个函数,该函数进行 $。ajax 调用以从第三方网址获取相关数据。

除了ios之外,它在每个设备和浏览器中都能正常工作。

这是我的按钮:

<input type="submit"  id="continue-btn" class="button primary-btn button-type-1" value="Buy Policy" onclick="validateCardDetails();" />

这是我的js函数:

function validateCardDetails() {


                var todaysPaymentOption, paymentOption, nameOnCard, ccExpYear, ccExpMonth, cardNumber, cardCVVCd, cardType, accHolderName, accType, accNumber, routingNumber, paymentAmount, repetitiveDrawDate, repPaymentOption, billingFrequency, futurePaymentAmount, rep_nameOnCard, rep_ccExpYear, rep_ccExpMonth, rep_cardNumber, rep_cardType, rep_accHolderName, rep_accNumber, rep_routingNumber, rep_accType, enableAutopay, policyNumber;
                var applicationId = $("#ppApplicationId").val();
                todaysPaymentOption = $("#paymentMethod input[type=radio]:checked").val();
                paymentOption = $("#selectedPaymentOption").val();
                nameOnCard = $("#tdyFname").val();
                ccExpYear = $("#ttdyexpyYear").val();
                ccExpMonth = $("#ttdyexpyMonth").val();
                cardNumber = $("#tdyCardnum").val();
                cardCVVCd = $("#tdyCardvv").val();
                var cardTypeTemp = $("#cardType input[type=radio]:checked").val();
                cardType = $("#cardType").val();
                accHolderName = $("#tdyAccountHolderName").val();
                accType = $("#accountType option[selected]").val() ? $("#accountType option[selected]").val() : '02';
                accNumber = $("#tdyBankAccount").val();
                routingNumber = $("#tdyRoutingNumber").val();
                paymentAmount = $("#todaysPayment").val();

                // $("#refNo").text(sfs);
                repetitiveDrawDate = "";

                repPaymentOption = "";
                billingFrequency = "";
                futurePaymentAmount = "";
                rep_nameOnCard = "";
                rep_ccExpYear = "";
                rep_ccExpMonth = "";
                rep_cardNumber = "";
                rep_cardTypeTemp = "";
                rep_cardType = "";
                rep_accHolderName = "";
                rep_accNumber = "";
                rep_routingNumber = "";
                rep_accType = "";
                enableAutopay = "false";


                policyNumber = $("#policyNumber").val();

                var contentObject = {
                        applicationID : applicationId,
                        todaysPaymentOption : todaysPaymentOption,
                        paymentOption : paymentOption,
                        nameOnCard : nameOnCard,
                        ccExpYear : ccExpYear,
                        ccExpMonth : ccExpMonth,
                        cardNumber : cardNumber,
                        cardCVVCd : cardCVVCd,
                        cardType : cardType,
                        accHolderName : accHolderName,
                        accType : accType,
                        accNumber : accNumber,
                        routingNumber : routingNumber,
                        paymentAmount : paymentAmount,
                        repetitiveDrawDate : repetitiveDrawDate,
                        repPaymentOption : repPaymentOption,
                        billingFrequency : billingFrequency,
                        futurePaymentAmount : futurePaymentAmount,
                        rep_nameOnCard : rep_nameOnCard,
                        rep_ccExpYear : rep_ccExpYear,
                        rep_ccExpMonth : rep_ccExpMonth,
                        rep_cardNumber : rep_cardNumber,
                        rep_cardType : rep_cardType,
                        rep_accHolderName : rep_accHolderName,
                        rep_accNumber : rep_accNumber,
                        rep_routingNumber : rep_routingNumber,
                        rep_accType : rep_accType,
                        enableAutopay : 'false',
                        policyNumber : policyNumber

                        };
                        // covert to query string format
                        var parameters = $.param(contentObject);

                        var paymentProcessorURL = $('#userDetailsValidatorUrl').val();

                    $.ajax({
                        type : "POST",
                        url : paymentProcessorURL,
                        crossDomain:true,
                                cache:false,
                        timeout: 15000,
                        data : parameters,
                        dataType: 'jsonp',
                        success : function(response) {
                         //response = parseJsonResponse(response);

                                processAjaxBillingResponse(response,todaysPaymentOption);
                        },
                        error : function(){
                         // if ajax call fails then handle error and display message on screen
                                var errorData = {"paymentAmount": paymentAmount};
                                var errorMessage = getPaymentErrorMessage("systemError",errorData);
                                showPaymentOptionsPage();
                                setGlobalErrorMessage("#globalValidation",errorMessage);
                        }
                    });
        }

0 个答案:

没有答案