在JavaScript中从2个数组转换/创建JSON

在JavaScript中从2个数组转换/创建JSON,javascript,php,ajax,arrays,json,Javascript,Php,Ajax,Arrays,Json,我在用JavaScript创建JSON数组时遇到问题。我的源代码如下所示: 阵列1: aOrderInformations[0] = BestellNummer; aOrderInformations[1] = Lieferant; aOrderInformations[2] = Bestellgrund; aOrderInformations[3] = Besteller; aOrderInformations[4]

我在用JavaScript创建JSON数组时遇到问题。我的源代码如下所示:

阵列1:

aOrderInformations[0]         = BestellNummer;
aOrderInformations[1]         = Lieferant;
aOrderInformations[2]         = Bestellgrund;
aOrderInformations[3]         = Besteller;
aOrderInformations[4]         = Mitarbeiter;
aOrderInformations[5]         = Standort;
aOrderInformations[6]         = Gesellschaft;
aOrderInformations[7]         = Bestelldatum;
aOrderInformations[8]         = Begruendung;
aOrderInformations[9]         = Lieferanschrift;
aOrderInformations[10]        = Rechnungsanschrift;

aOrderInformations = new Array(aOrderInformations);
array2来自带有ajax的服务器(这里是PHP):

array2(这里是Javascript):

当我单独调试这两个数组时,它将以正确的语法显示。但是,当我尝试按如下方式将其发送到php时,它不会组合数组并只显示一个数组:

{
  "0": {
    "0": "292",
    "1": "1",
    "2": "Microsoft",
    "3": "Maus",
    "4": "33355520",
    "5": "MISCO Germany Inc.",
    "6": "510014",
    "7": "1",
    "8": "22.02",
    "9": "22.02",
    "PostenID": "292",
    "ProduktID": "1",
    "Hersteller": "Microsoft",
    "Beschreibung": "Maus",
    "Produktnummer": "33355520",
    "Lieferant": "MISCO Germany Inc.",
    "Artikelnummer": "510014",
    "Menge": "1",
    "PreisNettoEinzeln": "22.02",
    "PreisNettoGesamt": "22.02"
  }
}
将组合数组发送到php的代码如下:

var postData = $.extend({}, aOrderInformations, aPositions);
var postData = JSON.stringify(postData);
if(!ajaxload2) {
    alert(postData);
    ajaxload2 = true;   
    $.ajax({
        type : 'POST',
        url : 'share/content/helper/writeorderdata.php',
        cache: false,
        dataType : 'json',
        data: {postData:postData},
        success: function() {
                        ajaxload2 = false;
        }
    });
} 

提示:SQL\u CALC\u FOUND\u行只有在使用
限制时才有用。你不是,所以这是毫无意义的。你在PHP中看到了什么?你的PHP代码是什么?或者您的问题是,为什么组合对象显示带有数字和单词键的JSON?如果您的两个项目有相同的键,Extend将结束自身的碰撞。您可以在ajax调用中分别发送这两个数组(在
数据部分)-这至少可以缩小问题所在的范围,就是这样@我已经编辑过了。谢谢
{
  "0": {
    "0": "292",
    "1": "1",
    "2": "Microsoft",
    "3": "Maus",
    "4": "33355520",
    "5": "MISCO Germany Inc.",
    "6": "510014",
    "7": "1",
    "8": "22.02",
    "9": "22.02",
    "PostenID": "292",
    "ProduktID": "1",
    "Hersteller": "Microsoft",
    "Beschreibung": "Maus",
    "Produktnummer": "33355520",
    "Lieferant": "MISCO Germany Inc.",
    "Artikelnummer": "510014",
    "Menge": "1",
    "PreisNettoEinzeln": "22.02",
    "PreisNettoGesamt": "22.02"
  }
}
var postData = $.extend({}, aOrderInformations, aPositions);
var postData = JSON.stringify(postData);
if(!ajaxload2) {
    alert(postData);
    ajaxload2 = true;   
    $.ajax({
        type : 'POST',
        url : 'share/content/helper/writeorderdata.php',
        cache: false,
        dataType : 'json',
        data: {postData:postData},
        success: function() {
                        ajaxload2 = false;
        }
    });
}