我想操縱從PHP文件調用的數組。它發出從jQuery中使用PHP數組
[{
"description": "Intel H67 Socket 1155 Motherboard",
"price": "144.99"},
{
"description": "Thermaltake WO319RU 850 Watt PSU Modular",
"price": "169.99"},
{
"description": "LG GH24NS70 SATA DVD Burner",
"price": "39.99"},
{
"description": "eVGA GTX 480 1536MB GDDR5",
"price": "299.99"}]
這是我的jQuery
$(document).ready(function() {
function get() {
var postdata = $('#scu').val();
$.post('data.php', {scu:postdata}, function(output) {
$('#output').append(output);
});
}
$('#scu').keyup(get);
});
//#scu is a textbox
//#output is an empty div
如果我這樣稱呼它它顯示了整個陣列;如果我這樣稱呼它output[0]
我會得到[;
如果我這樣稱呼它output[0].pric
E I得到一個unknown' error.
感謝那個偉大工程。 – user1114060