HTML doesn't display in Firefox

I am trying to return a PHP page via AJAX and it always loads in Chrome. In Firefox, it loads about 5% of the time, and in other cases it loads with nothing without JS / PHP errors. I just echo right back html back without CSS.

Here is my Ajax:

if(geo_position_js.init()){
            geo_position_js.getCurrentPosition(displayPosition,error_callback,{enableHighAccuracy:true,options:5000});
        }
        else{
            alert("Functionality not available");
        }

        function error_callback(p)
        {
            alert('error='+p.message);
        }       

    function displayPosition(loc) {
        var mylat = loc.coords.latitude;
        var mylong = loc.coords.longitude;
        $.ajax({
            type: "POST",
            url: "distancetest.php",
            data: "long="+mylong+"&lat="+mylat,
            success: function(html2){
                $('#locationinfo').html(html2);
                console.log(html);
           }
        });

    }

My PHP basically does this a couple of times:

$query = "SELECT * FROM tbl_geo WHERE cat_id=1";
    $result = mysql_query ($query) or die(mysql_error());
    echo "<h2>Restaurants</h2>";
    while ($row = mysql_fetch_array($result)){
        if($row['lat'] != ''){
            $distance = distance($_POST['lat'], $_POST['long'], $row['lat'], $row['lng'], "k");
            if($distance < 2000){
                $attractions[] = array('name' => $row['name'], 'address' => $row['address'], 'distance' => $distance);
            }
        }
    }
    $attractions = array_sort($attractions,'distance');
    $attractions = array_values($attractions);
    for ($i = 0; $i <= 10; $i++) {
        if(isset($attractions[$i]['distance'])){
            echo 'You are '.$attractions[$i]['distance'].'km away from '.$attractions[$i]['name'].' at '.$attractions[$i]['address'].'<br/>';
        }
    }

It works in some browsers, but does not display anything in others. Any ideas?

UPDATE: Turns out this is a geolocation issue in Firefox. It cannot get the position, but does not return to the error_callback function. Live example here: http://adamzwakk.com/geolocate/

+5
source share
3 answers

, , ?

: http://html5demos.com/geo

wirehark , .

php ( - ) , php, , . Windows , PHP , - . -, , , , . Safari Opera?

0

FireBug, , . , "undefined". FireBug , script :

<?xml version="1.0" encoding="utf-8" ?>
  <geoData>
    <restaurants>
    </place>
    </restaurants>
    <accommodations>
    </accommodations>
    <things>
    </things>
  </geoData>

, . , XML. , !

0

console.log()

console.log() javascript- , firebug . ( 95% ?)
- "dump (var)" dump.js, , firebug, .

PS: :

 success: function(html2){
   $('#locationinfo').html(html2);
   console.log(html);
 }

html html2.

0

All Articles