Guest User

Untitled

a guest
Jul 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. <form>
  2. <input placeholder="Search the area" class="input-large search-query" type="text" id="key">
  3. <input type="radio" name="b_selected" class="radio" value="1" > Today
  4. <input type="radio" name="b_selected" class="radio" value="2" > Tomorrow<br>
  5. <div class="result"><div class="loading"></div></div>
  6. </form>
  7.  
  8. include('config.php');
  9. $count= 0;
  10. if(isset($_POST["b_selected"]))
  11. { $b_selected = $_POST['b_selected']; }
  12.  
  13. $key = $_POST['key'];
  14. $b_selected = $_POST['b_selected'];
  15.  
  16. $key = addslashes($key);
  17. $sql = mysql_query("select * from account WHERE b_today='1' and title LIKE '%$key%' ") or die(mysql_error());
  18.  
  19. While($row = mysql_fetch_array($sql)) {
  20. $count++;
  21. $id= $row['id'];
  22. $title=$row['title'];
  23.  
  24. if($count<= 10){
  25.  
  26. /*quick search*/
  27.  
  28. $(document).ready( function() {
  29. $(".result").hide();
  30.  
  31. $("#key").keyup( function(event){
  32. var key = $("#key").val();
  33.  
  34. if( key != 0){
  35. $.ajax({
  36. type: "POST",
  37. data:{ key: key },
  38. url:"quicksearch.php",
  39. success: function(response) {
  40. $(".result").slideDown().html(response);
  41. }
  42. })
  43.  
  44. }else{
  45.  
  46. $(".result").slideUp();
  47. $(".result").val("");
  48. }
  49. })
  50.  
  51. })
  52.  
  53. /* Search for work plan for today or Tomorrow*/
  54.  
  55. $(document).ready(function(){
  56. $('input[type="radio"]').click(function(){
  57. var b_selected = $(this).val();
  58. $.ajax({
  59. url:"quicksearch.php",
  60. method:"POST",
  61. data:{b_selected:b_selected},
  62. success:function(data){
  63. $('#result').html(data);
  64. }
  65. });
  66. });
  67.  
  68.  
  69. });
Add Comment
Please, Sign In to add comment