返回ajax数组后的每个javascript

返回ajax数组后的每个javascript,javascript,Javascript,我的函数javascript setInterval(function(){ jQuery.post("item.php?ac=show", {}, function(data) { $.each(data, function(index, value) { console.log(value); }); }); }, 10000); 我的回归php Array ( [10] => Pago

我的函数javascript

setInterval(function(){
    jQuery.post("item.php?ac=show",
    {}, function(data)
    {
        $.each(data, function(index, value) {
           console.log(value);
        });
    }); 
}, 10000);
我的回归php

Array
(
  [10] => Pago
  [12] => Pago
)
我需要通过每个脚本读取来自php的javascript数组

$.ajax({
url: "item.php?ac=show",
success: function (response){
$.each(function (key, value){
console.log(value);
}):
}
});

查看此代码将解决您的查询。

我不知道您在问什么。该输出是PHP字符串化数组的方式,Javscript无法理解。您需要在PHP脚本中使用
json\u encode
以json格式返回数据,然后设置jQuery ajax选项,该选项表示您希望json作为响应。您还可以添加返回数组的代码片段吗?
  function getData() {
        $.ajax({
            url: "item.php?ac=show",
            type: "get",
            dataType: 'json',
            success: function (data) {
                $.each(data, function (index, value) {
                    console.log(value);
                });

            },
            error: function (jqXHR, textStatus, errorThrown) {
                console.log(textStatus, errorThrown);
            }
        });
    }

    setInterval(getData, 10000);