문제

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.

도움이 되었습니까?

해결책

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/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top