Trending sort Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping khổng lồ surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.Switch khổng lồ Trending sort
Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)
In order for you khổng lồ make this happen - I believe - you have to use AJAX.
The code will look like this:
Then you can JSON encode the results & pretty much output đầu ra them on the success. Your php script - however - must live on another php file.
Also, escape your data. Use prepared statements.
answered May 2, năm trước at 19:52
76922 gold badges1010 silver badges2626 bronze badges
showroom a phản hồi |
In theory, you could pass the vars lớn php via some sort of ajax call. I think it would go something like...
var data = "var1": $("selector").val(), "var2": $("selector").val();$.ajax( type: "post", url: "path-to-your-file.php", data: data, timeout: 50000).done(function(response) console.log(response);).fail(function(error) // uh-oh.);php:
Otherwise, you could use:cookie hidden input
NOTE: you will want khổng lồ sanitize the data. Using raw cookie and/or input đầu vào values could lead to lớn some less than desirable results.
edited May 2, năm trước at 20:23
answered May 2, năm trước at 19:57
3,65277 gold badges3838 silver badges8787 bronze badges
add a bình luận |
Use Method Post in AJAX or Form!! to lớn send js variable in Php & receive it in php using $_post< name_of_obj >;
answered May 2, năm trước at 19:56
1,4011616 silver badges3232 bronze badges
địa chỉ cửa hàng a bình luận |
Thanks for contributing an answer khổng lồ Stack Overflow!Please be sure to lớn answer the question. Provide details & share your research!
But avoid …Asking for help, clarification, or responding khổng lồ other answers.Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
Sign up using Google
Sign up using Facebook
Sign up using email and Password
Post as a guest
thư điện tử Required, but never shown
Post as a guest
thư điện tử
Required, but never shown
Post Your Answer Discard
The Overflow Blog
Featured on Meta
How can I đầu ra MySQL query results in CSV format?
Reference — What does this symbol mean in PHP?
Hot Network Questions more hot questions
Subscribe to RSS
Question feed lớn subscribe to this RSS feed, copy và paste this URL into your RSS reader.
Stack Exchange Network
Site thiết kế / logo © 2022 Stack Exchange Inc; user contributions licensed under CC BY-SA. Rev2022.8.2.42721