i am using ajax through jquery but it is not working here is my code can any one tell where is the problem
from view.php i am sending it as
<script>
function main()
{
navigator.geolocation.getCurrentPosition(successHandler, errorHandler);
function successHandler(location) {
var message = document.getElementById("message"), html = [];
var longitude = location.coords.longitude;
var latitude = location.coords.latitude;
var accuracy = location.coords.accuracy;
var temp="/project/index.php?r=merchant/userloc&id="+<?php echo $model->id ?>;
//alert(temp);
$.ajax({
type: "GET",
url: temp,
data: {
lat:latitude,
longi: longitude,
acc: accuracy,
},
success: function(data)
{
alert('received');
}
});
}
function errorHandler(error) {
alert('Attempt to get location failed: ' + error.message);
}
}
$(main);
</script>
from userloc.php i am getting it as
<?php
if(isset($_GET['lat']) && isset($_GET['longi']) && isset($_GET['acc']))
die("data received");
else
die("nothing received");
?>
it always die "nothing received"
whats wrong with this code