私は、JSONポストリクエストを使用して、mySQLデータベースから行を返します。私のサーバー側の言語はPHPであり、SQLの結果を約45に制限しない限り、私は応答を得ません。何のエラーもない。アドバイスをいただければ幸いです。 サーバサイドコードは次のとおりです。行数に制限がない限り、JSON後リクエストからの応答が得られないのはなぜですか?
<?php
include('../config.php');
$status = $_POST['status'];
$itemGrp = $_POST['itemGrp'];
$jobs_sql = "SELECT custName
,SODocNum
,itemName
,cast(thickness as decimal (4,2)) as 'thickness'
,case when ca_Description like 'Diary%' then ca_Description else 'Bespoke Diary' end as ca_Description
,Quantity
,version_id
,case when T0.rqdByDate is null then '' else T0.rqdByDate end as rqdByDate
,T0.despatchDate
,case when T0.versionStatus = 010 then '' else 'w3-disabled' end as 'disableCmpltBtn'
,case when T0.versionStatus = 010 then 'update_status_complete' else '' end as 'noclickCmpltBtn'
,case when T0.versionStatus = 009 then '' else 'w3-disabled' end as 'disableChkBtn'
,case when T0.versionStatus = 009 then 'update_status' else '' end as 'noclickChkBtn'
FROM Versions T0 left outer join components_all T1 on T0.itemCode = T1.ca_versionCFG and T1.ca_itemGroup in (117,118)
WHERE versionStatus in ('$status')
and ItmsGrpCod in ('$itemGrp')
order by thickness, T1.ca_itemCode asc, T0.despatchDate asc, SoDocNum
LIMIT 45";
$jobs_result = mysqli_query($db,$jobs_sql);
$all_array = mysqli_fetch_all($jobs_result);
echo json_encode($all_array);
?>
これは私がクライアント側で持っているものです。
function get_jobs_to_bind(){
console.log("Request data from server");
$.post("/_api/jobs_to_bind_api.php",
{
status:'007',
itemGrp:'121\',\'104\',\'106'
},
function(data) //on recieve of reply
{
console.log("Build table with data")
$('#jobs_to_bind_table_body').empty();
$.each(data, function (index, item) {
var eachrow = "<tr>"
+ "<td>" + item[0] + "</td>"
+ "<td style='text-align:center'>" + item[1] + "</td>"
+ "<td>" + item[2] + "</td>"
+ "<td>" + item[3] + "</td>"
+ "<td>" + item[4] + "</td>"
+ "<td>" + item[7] + "</td>"
+ "<td>" + item[8] + "</td>"
+ "<td>" + item[5] + "</td>"
+ "<td><button class='w3-btn w3-round w3-green w3-tiny' value = '" + item[6] + "' onclick='update_status(\"008\","+ item[6] +")'>Gathered</button></td>"
+ "<td><button id='viewgathererinfo' class='w3-btn w3-round w3-green w3-tiny' value = '" + item[6] + "' onclick='getgathererinfo("+ item[6] +")'>View</button></td>"
+ "</tr>";
$('#jobs_to_bind_table_body').append(eachrow);
});
filterbind2();
filterbind3();
},'json');
}
があまりにもあなたのSQLクエリに依存している
。投稿も同様に – Rahul
@Rahul私は交換を積み重ねてコードを追加する方法がわからないので申し訳ありません – Bobby
質問を編集してコードを貼り付けてください... atleast that much – Rahul