에 구문 오류가 궁금 해서요.JQuery와 사람이 잘못 무엇인지 말해 줄 수 있다면 배열
편집 : 전체 코드
<script type="text/javascript">
function cat_autocomplete(){
var categoryTags = ["boots>black","boots>brown>boys>blue","clothes>small_men>scarfs>blue","boots","boots>brown>boys","boots>brown","ties>casual","clothes","coats","clothes>girls","boots>brown>girls","clothes>small_men>hats","jackets","clothes>mens","clothes>red","boots>brown>red","clothes>small_men>scarfs","shoes","clothes>small_men","ties>smart","ties","clothes>womens"];
$("input[name=category]").autocomplete({
source: categoryTags
});
}
function prod_autocomplete(){
var productTags = ["clothes>small_men>hats","boots>black","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats","clothes>mens","clothes>small_men","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats","clothes>small_men>hats"];
$("input[name=product]").autocomplete({
source: productTags
});
}
$(document).ready(function(){
prod_autocomplete();
cat_autocomplete();
});
</script>
편집 : PHP 파일
<?php
session_start();
try{
require_once "../../classes/config.php";
require_once "../../classes/database.php";
require_once "../../classes/categories.php";
require_once "../../classes/global_data.php";
$cOb = new config();
$cOb->set_mode(0);
$cOb->set_table_prefix('lazy');
$cOb->dbdetails(array('dbuser' => '', 'dbpass' => '', 'dbserver' => 'localhost', 'dbname' => 'test'));
$cOb->set_srv_root('C:/wamp/www/ecom_framework/');
$cOb->set_sec_root('http://localhost/ecom_framework/');
$cOb->set_web_root('http://localhost/ecom_framework/');
$con = Database::getInstance($cOb);
ob_start();
?>
<script type="text/javascript">
function cat_autocomplete(){
var categoryTags = [<?php
$con = Database::getInstance();
$sql = "SELECT cat_id FROM `" . $cOb::$table_prefix . "_tbl_category` ORDER BY cat_name";
$re = $con->query($sql);
$str = '';
while($ob = $re->fetch_object()) {
$str .= '"' . categories::get_breadcrum_from_id($ob->cat_id, '>') . '",';
}
echo rtrim($str, ',') . "];\n";
?>
$("input[name=category]").autocomplete({
source: categoryTags
});
}
function prod_autocomplete(){
var productTags = [<?php
$con = Database::getInstance();
$sql = "SELECT cat_id, pd_name FROM `" . $cOb::$table_prefix . "_tbl_product` ORDER BY pd_name";
$re = $con->query($sql);
$str = '';
while($ob = $re->fetch_object()) {
$str .= '"' . categories::get_breadcrum_from_id($ob->cat_id, '>') . '",';
}
echo rtrim($str, ',');
?>];
$("input[name=product]").autocomplete({
source: productTags
});
}
$(document).ready(function(){
prod_autocomplete();
cat_autocomplete();
});
</script>
<?php
$content = ob_get_clean();
header("Content-type: text/javascript");
echo $content;
exit;
}catch(Exception $err){
die($cOb->mode($err->getMessage()));
}
?>
방화범이 실수를하지 않습니다. – BoltClock
어떤 구체적인 오류가 있습니까? – zerkms
구문 오류 http : //localhost/ecom_framework/admin/javascript/autocomplete.js.php Line 3 –