Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. function codeAddress(address) {
  2.  
  3. geocoder.geocode( { 'address': address}, function(results, status) {
  4. if (status == google.maps.GeocoderStatus.OK) {
  5. map.setCenter(results[0].geometry.location);
  6. var marker = new google.maps.Marker({
  7. map: map,
  8. position: results[0].geometry.location
  9. });
  10.  
  11. } else {
  12. alert('Geocode was not successful for the following reason: ' + status);
  13. }
  14. });
  15. }
  16.  
  17. function get_matches()
  18. {
  19. var info_ = document.getElementById('address').value;
  20. $.ajax({ url: 'find_store.php',
  21. data: {info: info_},
  22. type: 'get',
  23. success: function(output) {
  24. var html = output;
  25. $('#dress').html(html);
  26. var num =$('#row_c').html();
  27. var counter = 0;
  28. while(counter < num)
  29. {
  30. var addr = $('.addre#'+ counter).html();
  31. codeAddress(addr);
  32.  
  33. counter++;
  34. }
  35. }
  36. });
  37.  
  38. }
  39.  
  40. else if($type == 2)
  41. {
  42. $row_count = 0;
  43. $z_query = "select * from store_table where state like '%$accept%' and address like '%$accept%' limit 10";
  44. $result = mysql_query($z_query);
  45. $num_rows = mysql_num_rows($result);
  46. if($num_rows == 0)
  47. {
  48. echo"<script>alert("Your State look-up was unsuccessful, please try again")</script>";
  49.  
  50. }
  51. $width = ($num_rows * 300)."px";
  52. if($num_rows > 0)
  53. {
  54. echo"<div id = 'state_container' style = " margin:none; height:200px; backround-color:hsl(0,0%,95%); position:relative; padding:0px; overflow-x:hidden; overflow-x:scroll; overflow-y:none;">";
  55. echo"<ul style = 'list-style-type:none; margin-top:0px; margin-left:0px; padding-left:0px; width:$width;'>";
  56. while($row = mysql_fetch_assoc($result))
  57. {
  58. $state = "".$row['state']."";
  59. $store = "".$row['store_name']."";
  60. $phone = "".$row['phone']."";
  61. $addr = "".$row['address']."";
  62. $website = "".$row['website']."";
  63. $state = preg_replace('/s+/', '', $state);
  64. $phone = preg_replace('/s+/', '', $phone);
  65. $website = preg_replace('/s+/', '', $website);
  66. $state = stripslashes($state);
  67. $store = stripslashes($store);
  68. $phone = stripslashes($phone);
  69. $addr = stripslashes($addr);
  70. $website = stripslashes($website);
  71.  
  72.  
  73.  
  74.  
  75. echo"<li style = 'float:left; margin:none; margin-left:5px; margin-right:10px;'>";
  76. echo"<br/><b>$store</b>";
  77. echo"<br />$phone";
  78. echo"<br /><div class = 'addre' id = '$row_count' style = 'margin:0px; padding:0px;'>$addr</div>";
  79. echo"<br /><a href='$website' style = 'color:#000000; text-decoration:none;'>$website</a>";
  80. echo"</li>";
  81.  
  82.  
  83.  
  84. $row_count++;
  85. }
  86. echo"<script>$('#row_c').html($row_count)</script>";
  87. echo"</ul>";
  88. echo"</div>";
  89. }
  90.  
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement