Как читать статьи jquery из базы данных с php и ajax? Я использую этот плагин: http://loopj.com/jquery-tokeninput это мой JQuery код:jquery tokeninput читать объекты из базы данных
$("#demo-input-local").tokenInput(
'http://exapmle.com/index.php/mantaghe', {
theme: "facebook",
hintText: "Know of any cool games?",
noResultsText: "Nothin' found.",
searchingText: "Gaming...",
preventDuplicates: true
}
);
Это мой PHP-код в этом URL http://exapmle.com/index.php/mantaghe:
$db = JFactory :: getdbo();
$sql1 = "select * from sb5qt_djcf_regions where parent_id='0'";
$db ->setquery($sql1);
$result = $db -> loadAssocList();
$str = array("id" => "value",
"name" => "value",
"mantaghe" => "value");
foreach($result as $res)
{
$str['mantaghe'] = $res['mantaghe'];
$str['id'] = $res['id'];
$str['name']= $res['name'];
}
echo json_encode($str);
Что не работает? Можете ли вы добавить строку JSON, возвращаемую с сервера. – Chris
не может найти слова. Я не знаю, где я могу предупредить строку JSON, возвращаемую с сервера в моем jquery-коде. – viol
, обращаясь к веб-адресу, должен это сделать. – Chris