簡體   English   中英

服務器端處理數據表中的ajax調用問題

[英]ajax call issue in server side processing of datatables

我正在服務器端處理數據表。 但是我遇到了一個ajax錯誤,我將在后面解釋。 首先,這是我的代碼:

<table id="call_analysis_basic_table" class="display" cellspacing="0" width="100%">
    <thead style="background-color:#4d7496;color:#fff;" id="table_head">
        <tr>
            <th> Column 1 </th>
            <th> Column 2 </th>
            <th> Column 3 </th>
            <th> Column 4 </th>
            <th> Column 5 </th>
            <th> Column 6 </th>
            <th> Column 7 </th>
            <th> Column 8 </th>
            <th> Column 9 </th>
            <th> Column 10 </th>
        </tr>
    </thead>
</table>

使用Javascript

$(document).ready(function() {
    var dataTable = $('#call_analysis_basic_table').DataTable({
    "processing" : true,
    "serverSide" : true,
    "iDisplayLength": 5,
    "order" : [],
    "sAjaxSource" : {
        url : "http://localhost:8050/phpservice/final.php",
        type : "POST"
    }
});

當我加載頁面時,此數據表請求啟動,並在瀏覽器網絡設置中創建URL。 這是此代碼生成的網址:

http://localhost:8050/webapp/[object%20Object]?sEcho=1&iColumns=10&sColumns=%2C%2C%2C%2C%2C%2C%2C%2C%2C&iDisplayStart=0&iDisplayLength=5&mDataProp_0=0&sSearch_0=&bRegex_0=false&bSearchable_0=true&bSortable_0=true&mDataProp_1=1&sSearch_1=&bRegex_1=false&bSearchable_1=true&bSortable_1=true&mDataProp_2=2&sSearch_2=&bRegex_2=false&bSearchable_2=true&bSortable_2=true&mDataProp_3=3&sSearch_3=&bRegex_3=false&bSearchable_3=true&bSortable_3=true&mDataProp_4=4&sSearch_4=&bRegex_4=false&bSearchable_4=true&bSortable_4=true&mDataProp_5=5&sSearch_5=&bRegex_5=false&bSearchable_5=true&bSortable_5=true&mDataProp_6=6&sSearch_6=&bRegex_6=false&bSearchable_6=true&bSortable_6=true&mDataProp_7=7&sSearch_7=&bRegex_7=false&bSearchable_7=true&bSortable_7=true&mDataProp_8=8&sSearch_8=&bRegex_8=false&bSearchable_8=true&bSortable_8=true&mDataProp_9=9&sSearch_9=&bRegex_9=false&bSearchable_9=true&bSortable_9=true&sSearch=&bRegex=false&iSortingCols=0&_=1502908112765

此url將所有參數發送到處理服務器端處理的所需頁面。 但是http://localhost:8050/webapp/之后的http://localhost:8050/webapp/存在問題。 我不知道我的URL中的這個[object%20Object] doinhg是什么,我在電話中明確提到了api URL http://localhost:8050/phpservice/final.php

我認為除此以外一切都很好。 希望如此 !! 我沒有分享我的php代碼,因為php代碼沒有任何問題,服務器端工作正常

知道為什么這個url表現得像這樣並且表現不如預期嗎?

sAjaxSource不是對象。 僅將URL作為字符串傳遞。 如果需要使用POST,請設置sServerMethod:“ POST”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM