if (!message.member.hasPermission("MANAGE_MESSAGES") ||
!["507408804145528832"].includes(message.author.id)) return
message.channel.send(noperm);
PHP代码:
在此处输入代码
function pendingorder(){
app.request({
type:"POST",
url: "pages/getpeningorer.php",
dataType: 'json',
cache: false,
success:function(data) {
console.log(data);
var result = $.parseJSON(data);
$.each(result, function(key, value){
$.each(value, function(k, v){
if(k === "order_id"){
$("#pendingtable >tbody:last").append(
$('<tr>').append(
$('<td>').append(v)
.append(
$('</td>').append(
$('</tr>')
)
)
)
);
}
if(k === "product_id"){
$("#demoTable >tbody >tr:last").append(
$('<td>').append(v)
.append(
$('</td>')
)
);
}
if(k === "status"){
$("#demoTable >tbody >tr:last").append(
$('<td>').append(v)
.append(
$('</td>')
)
);
}
if(k === "remark"){
$("#demoTable >tbody >tr:last").append(
$('<td>').append(v)
.append(
$('</td>')
)
);
}
if(k === "postingDate"){
$("#demoTable >tbody >tr:last").append(
$('<td>').append(v)
.append(
$('</td>')
)
);
}
});
});
console.log(data);}
});
console.log('execute success');
}
I AM trying to call ajax through function....But not working. In a similar way, I post data it is working.
在这里,我正在以JSON格式将数据发送到ajax调用。但无法在HTML页面上查看数据。
答案 0 :(得分:0)
您的php代码似乎有问题,请尝试使用此代码
$row = mysql_fetch_array($result);
foreach($row as $r) {
$picture = array(
"order_id" => $r['order_id'],
"product_id" => $r['product_id'],
"status" => $r['status'],
"remark" => $r['remark'],
"postingDate" => $r['postingDate']
);
}