Pregunta

I have a catalogue of products that comes from a json file. I use different sorting methods to order it in one way or another. I would like to change the criterion of order when some checkboxes are checked, using javascript.

My question: Can I change the type of php sort using javascript, without reloading the page?

Thanks.

¿Fue útil?

Solución

If you want/have to sort your data with PHP, then you will have to send a request (Ajax: http://api.jquery.com/jQuery.get/) to your server and do the PHP magic. On response, you re-display your data via JS.

If the kind of sorting you need to perform is rather simple, then try to do it with JS; will be much(!) faster. Maybe this helps: https://datatables.net/

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top