Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array of objects differs from jQuery #62

Open
kellyselden opened this issue Apr 26, 2017 · 0 comments
Open

Array of objects differs from jQuery #62

kellyselden opened this issue Apr 26, 2017 · 0 comments

Comments

@kellyselden
Copy link

kellyselden commented Apr 26, 2017

najax:

/api/x?affiliations[][schoolId]=1234&affiliations[][endYear]=2020&affiliations[][startYear]=2016&affiliations[][schoolId]=5678&affiliations[][endYear]=2014&affiliations[][startYear]=2011

jQuery:

/api/x?affiliations[0][schoolId]=1234&affiliations[0][endYear]=2020&affiliations[0][startYear]=2016&affiliations[1][schoolId]=5678&affiliations[1][endYear]=2014&affiliations[1][startYear]=2011

The indexes are missing from the arrays, causing an interesting interpretation in Express:

{
  affiliations: [
    { schoolId: 1234 },
    { endYear: 2020 },
    { startYear: 2016 },
    { schoolId: 5678 },
    { endYear: 2014 },
    { startYear: 2011 }
  ]
}

instead of:

{
  affiliations: [
    { schoolId: 1234, endYear: 2020, startYear: 2016 },
    { schoolId: 5678, endYear: 2014, startYear: 2011 }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant