jQuery get functions response is OK但失败函数被触发

时间:2019-08-21 13:14:05

标签: javascript jquery ajax

我正在调用jQuery get函数,并且响应是预期的结果。但不是成功,而是失败功能被触发。

    $(document).ready(function(){
        jQuery("#placeOrderForm").submit(function(e){
            e.preventDefault();

            // AJAX call
            jQuery.get(
                '/checkout/multi/get-payment-url',
                jQuery(this).serialize(),
                "GET"
            ).done(function( data ) {
                alert( "Data Loaded: " + data );
            }).fail(function(data) {
                console.log( "error" );
                console.log( data );
            })
            .always(function(data) {
                console.log( "finished" );
                console.log( data );
            });
        });
    });

响应状态为status: 200statusText: "OK"。 在哪里可以看到可能发生的实际错误,以及如何解决?

部分回复:

abort: function abort()​
always: function always()​
catch: function catch()​
done: function add()​
fail: function add()​
getAllResponseHeaders: function getAllResponseHeaders()​
getResponseHeader: function getResponseHeader()​
overrideMimeType: function overrideMimeType()​
pipe: function pipe()​
progress: function add()​
promise: promise()
length: 1
name: "promise"
prototype: Object { … }
<prototype>: function ()
readyState: 4
responseText: "\"https://wpp-test.wirecard.com/?wPaymentToken=xyz""
setRequestHeader: function setRequestHeader()​
state: function state()
status: 200
statusCode: function statusCode()
statusText: "OK"
then: function then()​
<prototype>: {…

0 个答案:

没有答案