在完成方法后,Ajax调用将重定向某些URL

时间:2018-08-09 13:40:13

标签: netsuite

有一个Ajax调用,它将从Net Suite返回数据.Ajax调用记录加载到数据表中之后,一旦涉及到完整的Ajax调用方法,它将重定向到新的URL。

$.ajax({
    url: '/RecordTypes/GetAccountDetails',
    type: "POST",
    dataType: 'json',
    async:false,
    data: {
        queryString: queryData, entity: ddvalue
    },
    //async: false,
    success: function (data) {
        debugger;              
        if (data.length > 0) {
            var thead = $('<thead />');
            var headRow = $('<tr />');
            var tbody = $('<tbody />');
            var tdAction = $('<td />', {
                html: "Action"
            });
            headRow.append(tdAction);
            $.each(data[0].EntityList, function (i, v) {
                //if (i != "Id" && i != "OwnerId" && i != "OwnerName" && i != "LineItemNumber" && i != "CompanyID" && i != "ContractID" && i != "ProductID" && i != "UserID") {
                var tdHead = $('<td />', {
                    html: i
                });
                headRow.append(tdHead);
            });
            thead.append(headRow);
            //thead.append($(headRow).html().replace(/_/g, ' '));
            //alert($(headRow).html().replace(/_/g, ' '));
            $('#Accountdatatable').append(thead);
            $('#Accountdatatable').append(tbody);
            $.each(data, function (i, row) {
                AddPreviewData(row);
            });
            var table = $('#Accountdatatable').dataTable();

            $('#totalrec').html(data.length);
            $('#message').hide();

            btn.prop('disabled', false);
        }
        else {
            $('#message').html('');
            $('#message').show();
            $('#message').html('No Records found !!!');
            $('#noRecordMessage').modal('show');
            btn.prop('disabled', false);
        }
    },
    error: function (data) {

    },
    complete: function (data) {
        btn.prop('disabled', false);
        spinner.stop();
    }
});

完成方法后,它将转到jquery-3.1.1中的以下方法并重定向到以下URL http://shopping.netsuite.com/site/products-professional-antivirus.htm

// Callback
    callback = function( type ) {
        return function() {
            if ( callback ) {
                callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;

                if ( type === "abort" ) {
                    xhr.abort();
                } else if ( type === "error" ) {
                    // Support: IE <=9 only
                    // On a manual native abort, IE9 throws
                    // errors on any property access that is not readyState
                    if ( typeof xhr.status !== "number" ) {
                        complete( 0, "error" );
                    } else {
                        complete(
                            // File: protocol always yields status 0; see #8605, #14207
                            xhr.status,
                            xhr.statusText
                        );
                    }
                } else {
                    complete(
                        xhrSuccessStatus[ xhr.status ] || xhr.status,
                                xhr.statusText,

                        // Support: IE <=9 only
                        // IE9 has no XHR2 but throws on binary (trac-11426)
                        // For XHR2 non-text, let the caller handle it (gh-2498)
                        ( xhr.responseType || "text" ) !== "text"  ||
                            typeof xhr.responseText !== "string" ?
                                { binary: xhr.response } :
                                { text: xhr.responseText },
                            xhr.getAllResponseHeaders()
                    );
                }
            }
        };
    };

0 个答案:

没有答案