0

I would like to know if i can send an array of this type endate [] in the parameter fecha2 of the following url:

http://www.xxxx.com/app/disponibilidad?idUser&fecha2&fecha1&desde&hasta

endate[] has several date I want to send in a single url. I would like to know if that is possible

1 Answer 1

2

You can get a good idea in How to pass an array within a query string?

You can also encode it to JSON and pass it as a single string, then decode it on your backend. Sounds simpler to me.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for the reply, how to address the json encoding to the server www.xxxx.com/app/ disponibilidad
You can create a JSON string from an array with Javascript's functionJSON.stringify(arr);
If you're thinking in pass a json as a query parameter, I think you may use a post instead of a get
But as concatenary this url: xxxx.com/app/prueba url. With this json: {"disponibilidad":[{"idUser":"4","fecha2":"30 June, 2017","fecha1":"28 June, 2017","slotH":"1 hora","desde":"11:00 AM","hasta":"03:00 PM","entre":"10 minutos"},{"idUser":"4","fecha2":"30 June, 2017","fecha1":"29 June, 2017","slotH":"30 minutos","desde":"04:00 PM","hasta":"06:00 PM","entre":"15 minutos"}]}
if you wish to pass all that as GET parameters, then concatenate it as "xxxx.com/app/disponibilidad?Myarray="+JSON.stringify(arr)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.