更新时间:2023-02-26 10:07:31
你不能从js访问数组(php数组)试试
you cannot access array (php array) from js try
<?php
$array = array(1,2,3,4,5,6);
echo json_encode($array);
?>
和js
$(document).ready( function() {
$('#prev').click(function() {
$.ajax({
type: 'POST',
url: 'ajax.php',
data: 'id=testdata',
dataType: 'json',
cache: false,
success: function(result) {
$('#content1').html(result[0]);
},
});
});
});