我在我的 config.php
文件中有这个
$DOMAIN = http://domain.com ;
$DOMAIN_SSL = http://domain.com ;
$DOMAIN_ROOT = var/domain/root/html ;
config.php
包含在第一行的每一页中。
现在我有了这个 jQuery 代码
var country = <?php echo $_GET[ country ];?> ;
var category = Cat ;
var category = <?php echo $DOMAIN. /link ; ?> ;
如何从 JQuery 代码的 php 中获取变量, 使 jQuery 代码变成这样?
var country = $country ;
var category = Cat ;
var url= $domain , /link ;
ORIGINAL CODE I NEED TO EXLUDE PHP
var country = <?php echo $_GET[ country ];?> ;
var category = CAT1 ;
function loadData(page){
loading_show();
$.ajax
({
type: "POST",
url: "<?php echo $DOMAIN ?>/post.php",
data: "page="+page +"&category="+category+"&country="+country,
success: function(msg)
{
loading_hide();
$("#content-large").html(msg);
}
});
}
loadData(1); // For first time page load default results
$( #content-large .pagination li.active ).live( click ,function(){
var page = $(this).attr( p );
loadData(page);
});
$( #go_btn ).live( click ,function(){
var page = parseInt($( .goto ).val());
var no_of_pages = parseInt($( .total ).attr( a ));
if(page != 0 && page <= no_of_pages){
loadData(page);
}else{
alert( Enter a PAGE between 1 and +no_of_pages);
$( .goto ).val("").focus();
return false;
}
});
});