Jump to content

BenRacicot

New Members
  • Posts

    4
  • Joined

  • Last visited

BenRacicot's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Excellent answer, thank you. Can you point me in the right direction for how to reliably get the 301 redirected URL? get['url'] or By using JS instead?
  2. Hello, I'm trying to grab the domain from a 301 redirect with masking. I can grab the domain name in Chrome with: <?php echo parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST); ?> This doesn't work in other browser because: from the php manual, "This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. Anyone have experience reliably getting the 'domain.com' from the referrer when dealing with 301 redirect (with masking) in all browsers? (if it must be done with regex can you please be detailed) Thanks
  3. Waddup freaks? Thought I'd ask the more experienced people about Google places. I've been working on this very simple places search and I cannot get anything but a ZERO_RESULTS. It makes no sense to me at this point and I am offering up some code for debug if you'd be so kind. //BEGIN GOOGLE PLACES $( "#submit3" ).click(function(e) { e.preventDefault(); findPlaces(); $('#results').text("Triggah3!"); }); function findPlaces() { // prepare variables (filter) // var type = document.getElementById('gmap_type').value; // var radius = document.getElementById('gmap_radius').value; // var keyword = document.getElementById('gmap_keyword').value; var lat = document.getElementById("latitude").value; var lng = document.getElementById("longitude").value; // var lat = document.getElementById('lat').value; // var lng = document.getElementById('lng').value; var cur_location = new google.maps.LatLng(lat, lng); // prepare request to Places var request = { location: cur_location, radius: 50000, types: 'bank' }; // if (keyword) { // if used grab contents of search field // request.keyword = [keyword]; // } //console.log(request); // send request service = new google.maps.places.PlacesService(map); service.search(request, createMarkers); } // create markers (from 'findPlaces' function) function createMarkers(results, status) { // console.log(results); if (status == google.maps.places.PlacesServiceStatus.OK) { //ZERO_RESULTS // if we have found something - clear map (overlays) clearOverlays(); // and create new markers by search result for (var i = 0; i < results.length; i++) { createMarker(results[i]); } } else if (status == google.maps.places.PlacesServiceStatus.ZERO_RESULTS) { alert('Sorry, nothing is found'); } } // create single marker function function createMarker(obj) { // prepare new Marker object var mark = new google.maps.Marker({ position: obj.geometry.location, map: map, title: obj.name }); markers.push(mark); // prepare info window var infowindow = new google.maps.InfoWindow({ content: '<img src="' + obj.icon + '" /><font style="color:#000;">' + obj.name + '<br />Rating: ' + obj.rating + '<br />Vicinity: ' + obj.vicinity + '</font>' }); // add event handler to current marker google.maps.event.addListener(mark, 'click', function() { clearInfos(); infowindow.open(map,mark); }); infos.push(infowindow); } //END GOOGLE PLACES My script is loading just fine, in fact the map and some marker from my database load just fine upon their button click. Here is my link to the Google map API, key and library: <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3&sensor=true&libraries=places&key=AIva&&DCtOkeKl&&xHLrC7eYzoLXzPrbdkkkYU&&2"></script>
  4. Hello everyone! I've been at this WordPress AJAX functionality for almost 2 weeks and I've had it working in a basic state for about 2 days. However passing along geolocation data WITH the $.ajax data is ruining my life. Here's what's going on: // click "trigger" function $("#searchsubmit").click(function(e){ e.preventDefault(); // data: object data = { action:'wpa56343_search', latitude: $('input#latitude').attr('value'), longitude: $('input#longitude').attr('value') }; _do_ajax(data); }); // end click func function _do_ajax(obj) { console.log(obj); $.ajax({ type:"POST", url: My_Obj.ajaxurl, // the request is sent to admin-ajax.php data: data, dataType: 'json', success: function( response ){ loops and stuff } WordPress is very specific as to the ways you can do AJAX requests. If you're not familiar with them: The above queries a wp_ajax_ACTION in functions.php. My action function is called wpa56343_search. This function is where I need to include post variables for use within the query it performs. The way it is working now logs Object {action: "wpa56343_search", latitude: "42.041261299999995", longitude: "-70.9414206"} Now why can't I get these through traditional methods such as: $latitude = $_POST['latitude']; $longitude = $_POST['longitude']; // to use within the query function function my_ajax_search($latitude, $longitude){ query here }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.