How do I send array over AJAX as part of JSON message

  • Hi, guys. Please tell me, how can i do this thing: i need to post on server JSON like this - {cmd: 'choosePlayers',choiceId: 3, choice: [1,2,3]}. [1,2,3] - this must be array from Construct2, but i can only use Array.AsJSON and in this way it looks like

    {cmd: 'choosePlayers',choiceId: choice: {

    "c2array": true,

    "size": [1,1,0],

    "data": [ [[13]],

    [

    [14]]

    ]

    }

    }

    in this case i get parse error. sorry for bad english

  • So parse the array yourself into the format you need, if you can't change it on the other end.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So parse the array yourself into the format you need, if you can't change it on the other end.

    i cant even receive the message. Express(using Node.JS as server) give me error before then i can do something with it. i can try to change something in Express module, but maybe there are other ways?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)