I have an html input that sends the query string through an ajax call to my php server. The search string can be complex and allow for filters, my implementation question looking for feedback is should I handle the parsing of the fields/values on the client side and dynamically add post values or should I handle everything on the server side?
'search string category:sports submitted:today'
Then I could either
(POST) q='search string category:sports submitted:today'
query='search string'
category='sports'
submitted'today'
OR
(POST) q='search string'
(POST) category='sports'
(POST) submitted='today'
query='search string'
category='sports'
submitted='today'
Depends on how interactive you want your application to be.
IF the client parses it while the user is typing, you could provide auto-fill features and validation. Else you have to wait for the user to be done and then receive feedback from the server.
Technically it is not a big deal for the server-side to parse. But it just may not be the optimum application behavior.
I would choose way 1 because of minimum interactions between server and client.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With