這是我的javascript代碼填寫格:獲取價值,PHP和使用PHP網格(也就是在PHP文件)
$(document).ready(function()
{
$("li").click(function() {
var childid = $(this).attr("id"); /* this works(gets id of clicked li) */
if(childid)
{
var child = childid.split(';;;');
$('#Grid').load('../Grid/FillWithGrid.php',{"name" : child[1], "family" : child[0]}); /* I think problem is here */
}
})
})
<div class="Grid" id="Grid">
This is index.php where it must be pasted
</div>
這是FillWithGrid.php:
<?PHP
header('Content-Type: text/html; charset=utf-8');
require_once("../Grid/conf.php");
$conn = mysql_connect(PHPGRID_DB_HOSTNAME,PHPGRID_DB_USERNAME,PHPGRID_DB_PASSWORD);
$CHName = mysql_real_escape_string($_GET["name"]); /*ERROR : Undefined value*/
$CHFamily = mysql_real_escape_string($_GET["family"]); /*ERROR : Undefined value*/
mysql_close($conn);
if($CHFamily & $CHName)
{
$query = "select * from `view_marks` where `name` = '$CHName' and `family` = '$CHFamily' ";
$dg1 = new C_DataGrid($query);
$dg1->enable_advanced_search(true);
$dg1 -> display();
}
?>
1)我無法從javascript獲取childname和childfamily。它說'未定義的名字'和'未定義的家庭'。所以它不會從JavaScript獲得價值。 - - 解決!!!
2)是示出空白頁,當我點擊李...
有任何人有任何想法。請幫忙
謝謝!!!
它包含名稱;;;家庭它成功分裂。我提醒它,它的工作問題是我標記的地方,我相信但我無法解決這個問題。 – user2971569