Skip to content
This repository was archived by the owner on Oct 4, 2022. It is now read-only.
This repository was archived by the owner on Oct 4, 2022. It is now read-only.

Problem sending data via ajax post request #18

@mm765

Description

@mm765

Hi,
i have a problem sending data via a post request to my server.

It works fine with simple data (strings, numbers) but it goes wrong when i send arrays or objects as the data.
I have this data structure that i am trying to send:
(console.log on the client)
Userdata
Object {Name: "mm", LoginName: "mm", Password: "mm", Roles: Array[2], Language: "de"…}
Groups
:
Array[2]
0
:
"56f064923e30b1c32aabd8ef"
1
:
"56f064923e30b1c32aabd8f0"
length
:
2
proto
:
Array[0]
Language
:
"de"
LoginName
:
"mm"
Name
:
"mm"
Password
:
"mm"
Roles
:
Array[2]
0
:
"56f064923e30b1c32aabd8ec"
1
:
"56f064923e30b1c32aabd8ed"
length
:
2
proto
:
Array[0]
proto
:
Object

i send this as an object like this
data = {}
data.userData = (above object)
simplified
ajax
type: POST
content-type: application/json
data: data

on the server console.dir(reqdata: req.data) shows:
(object)
reqdata
itkfc e203eaaa-3200-8fe3-8f55-57643d68b2a5
userData%5BName%5D mm
userData%5BLoginName%5D mm
userData%5BPassword%5D mm
userData%5BRoles%5D%5B%5D 56f064923e30b1c32aabd8ed
userData%5BLanguage%5D de
userData%5BGroups%5D%5B%5D 56f064923e30b1c32aabd8f0

if i dont send it as a subobject of the data, i get a problem with the arrays (Roles, Groups) where it displays them similar to the above.
Any idea ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions