无法通过ajax发布数组

时间:2013-11-05 16:37:32

标签: php ajax arrays post

我试图将在js中创建的数组发布到php页面

 var newEventArray = new Array();  
        newEventArray["title"] = title;
        newEventArray["description"] = description;
        newEventArray["type"] = type;
        newEventArray["visibility"] = visibility;
        newEventArray["priority"] = priority;
        newEventArray["start"] = start;
        newEventArray["end"] = end;
        newEventArray["allDay"] = allDay;

        $.ajax({
            type: "POST",
            url: "includes/processor.php",
            data: {request: 'createevent',
                requestarray: newEventArray},

            dataType: "json",
            success: function(data) {

            },
            error: function(data) {
            }
        });

但是我无法在php端获取数组。使用firebug检查数组时不显示

1 个答案:

答案 0 :(得分:0)

JavaScript数组用于保存带有整数键的有序序列。当jQuery将数据结构转换为表单URL编码数据并遇到数组时,它将迭代这些整数键而不是命名键。

如果您想要命名密钥,请使用对象。