How execute first jquery before my php classes
Hi how can I execute first my jQuery scripts before my php code.
Here is my (javascript/jQuert) code:function success_callback(p)
{
jQuery.post("http://geolocation.php", { latlong: LatLong, country: CountryName, city: LocaLityName},
function(data){
jQuery("#debug").text(data);
jQuery("div").show();
});
}
PHP CLASS located in geolocation.php:
$data = array();
$data['id'] = 267722;
$data['latlong'] = $_POST['latlong'];
$data['country'] = $_POST['country'];
$data['city'] = $_POST['city'];开发者_Go百科
print_r($data);
GetLatLong::GetLocation($_SESSION['cId'],$_POST['latlong'], $_POST['country'], $_POST['city']);
if($flag == true){
new Statistics($data, $db, $type);
}
The new Statistics($data, $db, $type);
code is always execute even I put a flag on it.
If your PHP is being called by the jQuery, then by definition, isn't the jQuery running first?
As to the new Statistics always being executed even when you put a flag on it, perhaps its because you never actually initialized the flag?
精彩评论