【发布时间】:2017-08-24 12:45:16
【问题描述】:
这是我的简单代码
$.ajax({
url:'action.php',
method: 'POST',
data:{getcart:1},
success:function(response){
$('#getcart').html(response);//want to display $return_value (from action page)
$('#getcart2').html(response);//want to display $return_value2 (from action page)
}
});
我在这里向 action.php 发送请求
如果在 action.php 中我分别回显了两个变量。
$return_value = " //Some html here "; echo $return_value;
$return_value2= "//some other html"; echo $return_value2;
所以问题是在 ajax 中,我有带参数响应的函数。我将如何能够从 php 接收这两个变量并将其显示在不同的 div 中。 我希望你们帮助我。谢谢。
【问题讨论】:
-
从您的 PHP 中返回一个数组或对象。
标签: javascript php jquery mysql ajax