在我的一个php文件中,我正在运行一个查询,无论查询结果如何显示我想要放入number.js文件的值。即使我在该PHP文件中复制了.js代码,但在主文件(index.php)中我正面临着js文件的冲突。这就是为什么我不能将js文件复制到该php文件中。请给我提供的信息。在下面我复制我的PHP代码以及js文件。如何将json值php传递给js
在PHP代码
$query_string = "SELECT COUNT(Email) AS total FROM Contact INNER JOIN CompanyBranch ON Contact.CompanyBranchID = CompanyBranch.CompanyBranchID INNER JOIN Company ON Company.CompanyID = CompanyBranch.CompanyID INNER JOIN CompanyIndustry ON Company.CompanyID = CompanyIndustry.CompanyID INNER JOIN IndustrySubindustry ON CompanyIndustry.IndustrySubindustryID = IndustrySubindustry.IndustrySubindustryID WHERE CompanyBranch.GlobalRegionID = '$global_region' AND IndustrySubindustry.IndustryID = '$industry' AND IndustrySubindustry.SubindustryID = '$sub_industry'";
$query_string = strtolower($query_string);
$result_data = mysql_query($query_string) or die();
//$tmp = mysql_fetch_array($result_data);
$row = mysql_fetch_assoc($result_data);
$total_lead = $row['total'];
echo json_encode($total_lead);
任何价值得到,我想重定向到文件number.js
代码在number.js文件的$total_lead
变量
var leads=0;
我想var_leads=$total_lead
(值来自php文件)。
怎么可能?
总是用正确的标记。其做出很大的区别... – 2012-02-22 04:01:25