javascript - Ajax to Filter Results Without Reloading
Get the solution ↓↓↓Solution:
From your API, make sure you're auditing the request coming from the client. Check for bounds, make sure it's not malformed, make sure it fits what you're expecting. If it's invalid, send back a proper response to the client stating so (403/404/etc)... if it's valid, then send back the filtered results.
Answer
Solution:
You shouldn't send raw SQL from the client. Just send the values of the form fields, and use them in the PHP script on the server to construct the SQL query.
See https://stackoverflow.com/a/28909923/1491895 for a technique to generate theWHERE
clause dynamically from form fields. Similar methods can be used for theORDER BY
clause.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: php_network_getaddresses: getaddrinfo failed: temporary failure in name resolution
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.