Advertisement
Guest User

Untitled

a guest
May 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $('#searchInput').keyup(function() {
  2. var searchField = $('#searchInput').val();
  3. var searchExp = new RegExp(searchField, "i");
  4. $.getJSON('/Lobster/wp-content/themes/Lobster/business-info.php', function(data) {
  5. var listing = '<div id="resultsList">';
  6. $.each(data, function(key, val) {
  7.  
  8. // var lng = (val.longitude);
  9. // var lat = (val.latitude);
  10. // var coord = [lng, lat];
  11. if ((val.name.search(searchExp) != -1) ||
  12. (val.street.search(searchExp) != -1) ||
  13. (val.town.search(searchExp) != -1) ||
  14. (val.zip.search(searchExp) != -1)) {
  15. listing += '<div id="listing">';
  16. listing += '<h3>' + val.name + "</h3>";
  17. listing += '<p>' + val.street + " " + val.town + ', ME ' + val.zip + "</p>";
  18. listing += '<button class="submitNew" id="submitNew">' + 'Submit new price' + '</button>';
  19. listing += "</div>";
  20. }
  21. });
  22. listing += "</div>";
  23. $('#resultsContainer').html(listing);
  24.  
  25. });
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement