SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast britton's Avatar
    Join Date
    Jul 2005
    Location
    Tennessee
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Any Idea What is Wrong With The Post Portion of this Code?

    This is code for updating a user's geo-coordinates in the database. It passes latitude and longitude to a php file which then updates a MySQL database. It works fine on desktops but not on mobile phones. It is properly pulling the latitude and longitude universally but on mobile phone browsers it doesn't seem to be posting or passing it to the PHP file.

    Code:
    <script>jqcc=jQuery.noConflict(true);</script>
    <script>
    function initialize_map()
    {
        var myOptions = {
    	      zoom: 4,
    	      mapTypeControl: true,
    	      mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
    	      navigationControl: true,
    	      navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
    	      mapTypeId: google.maps.MapTypeId.ROADMAP      
    	    }	
    	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    }
    function initialize()
    {
    	if(geo_position_js.init())
    	{
    		document.getElementById('current').innerHTML="Receiving...";
    		geo_position_js.getCurrentPosition(show_position,function(){document.getElementById('current').innerHTML="Couldn't get location"},{enableHighAccuracy:true});
    	}
    	else
    	{
    		document.getElementById('current').innerHTML="Functionality not available";
    	}
    }
    
    function show_position(p)
    {
    	document.getElementById('current').innerHTML="latitude="+p.coords.latitude.toFixed(2)+" longitude="+p.coords.longitude.toFixed(2);
    	var pos=new google.maps.LatLng(p.coords.latitude,p.coords.longitude);
    	map.setCenter(pos);
    	map.setZoom(14);
    
    	var infowindow = new google.maps.InfoWindow({
    	    content: "<strong>yes</strong>"
    	});
    
    	var marker = new google.maps.Marker({
    	    position: pos,
    	    map: map,
    	    title:"You are here"
    	});
    
    	google.maps.event.addListener(marker, 'click', function() {
    	  infowindow.open(map,marker);
    	});
    
    var lat = p.coords.latitude.toFixed(2);
    var lon = p.coords.longitude.toFixed(2);
    var data = 'lat='+ lat +'&lon='+ lon;
    
    
    jQuery.ajax({
    type: "POST",
    url: "updategeo.php",
    timeout: 4000,
    //beforeSend: function() {
    //$("#loadingScreen").html('<img src="link to loading image, optional" alt="" />');
    //},
    data: data,
    
    });
    }
    </script >

  2. #2
    SitePoint Enthusiast britton's Avatar
    Join Date
    Jul 2005
    Location
    Tennessee
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind. This has been resolved. As it turns out there was nothing wrong with this code, it was a cache/cookie issue related to a different file.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •