php - How to send link id's to a sql query using jQuery? -
I am trying to send the link ID in SQL query to filter the data.
When I click on a link like the link below, I would like to send an ID of SQL query as the following link:
Example: link (click) :
& lt; P & gt; Fitler results & lt; / P & gt; & Lt; A href = "#" class = "category" id = "marketing" & gt; Marketing & lt; / A & gt; & Lt; A href = "#" class = "category" id = "automotive" & gt; Automotive & lt; / A & gt;
(not clicked):
& lt; A href = "#" class = "category" id = "sports" & gt; Game & lt; / A & gt;
SQL query - I have worked hard on ID but I want to know when someone clicks on a link, in this case marketing and automotive, I want the ID to be automated By jquery form but it is not known how to do it properly:
$ query1 = "SELECT * FROM WHERE from category IN ('marketing', 'automotive',) to category According to the limit limit $ $ $ limit "; Just return a jquery ajax post to false with false, and capture the results. / P> $ ('a'). Click (function () {$ .post ("querypage.php", {id: "$ (this) .attr ('id')"}, function (data) {dosomethingwithdata (data);}); // False refund does not refute false to return the page;}); Then in your php page (= querypage.php): $ query1 = "SELECT * FROM EXPLORE WHERE". $ _ POST ["ID"]. "IN ('Marketing', 'Automotive',) Limit Limit $ Border, $ Border";
offcourse You now have to execute the query and return the desired result.
I hope this helps, I do not have any comments if comment
Comments
Post a Comment