在我的 JavaScript 文件中,我有以下内容:
现在我知道我没有通过ajax函数传递任何数据,我只是写了上面的内容来测试一件事,那就是:
当我弹出
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$.ajax({
type: 'post',
url: 'script.php',
data: '',
success: function(output) {
alert(output[0])
}
});
</script>
在我的PHP文件中,我有以下内容:
<?php
echo 'dog';
echo 'cat';
?>
现在我知道我没有通过ajax函数传递任何数据,我只是写了上面的内容来测试一件事,那就是:
当我弹出
output[0]
时,我得到字母"d"。相反,我想要得到"dog",当我弹出output[1]
时,我想要得到"cat"。如何实现这一点?