Initially, I expected a simple question but it's proving to be more challenging than I thought. To provide some context, there is a JSON string returned from the server located within data.occupation
.
{"occupation": "Boxer", "id": 2},{"occupation": "Helper", "id": 3}
My goal is to obtain an array of ids: [2, 3]
Despite my attempts to iterate through this data set, I keep encountering type errors and undefined values.
Can JQuery handle this task or should I consider parsing the backend to send an array of ids to JQuery?