Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. var geoSearch = new google.maps.Geocoder;
  2. jQuery(document).ready(function() {
  3. var address = FYN_search.postcode;
  4. if(jQuery.type( address ) === "string"){
  5. var region = 'Austria';
  6. address = address + ', ' + region;
  7. geoSearch.geocode({'address':address,'region':region},function(results, status){
  8. if (status == google.maps.GeocoderStatus.OK) {
  9. var point = results[0].geometry.location;
  10. var data={
  11. action:'filter_search',
  12. lat:point.lat(),
  13. lng:point.lng()
  14. }
  15.  
  16. jQuery.post(FYN_search.ajaxurl, data, function(returndata){
  17. console.log('ajax posting');
  18. jQuery('#resulit').html(returndata);
  19. });
  20.  
  21. } else {
  22. alert("Geocode was not successful for the following reason: " + status);
  23. }
  24. });
  25. }
  26. });
  27.  
  28. add_action('wp_ajax_filter_search', 'filter_search_result');
  29.  
  30. function filter_search_result(){
  31. echo 'hello world';
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement