我试图在javascript中创建一个包含动态值的json对象。我需要通过AJAX调用将这个JSON对象传递给服务器。但我无法添加动态值。var taskValue = tasks[i]; // need to add this in the JSON Object最后一个JSON对象应该如下所示: tasks4: '
我在php中有以下内容:
$follow=explode(" ",$_SESSION['Following']); //create array from the string stored in循环,json对象看起来是这样的:{key:value}...,它可以在我的javascript中解析。但是,使用foreach中的多个传递,我在对象中获得了多个数组,如下所示:{key:value}.....这会导致下面的Syntax