我试图在其中显示带有标记&的搜索结果。但是当我从php渲染json &转换为&安培。Twitter typeahead显示'&amp'而不是'&'
是否有反正我可以阻止,或之前我在搜索栏中打印名称将它转换回&?
在此先感谢!
编辑: HTML JS:
{
name: 'industries',
prefetch: 'industries_json.json',
header: '<h1><strong>Industries</strong></h1>',
template: '<p>{{value}}</p>',
engine: Hogan
},
industries_json.json(创建了json_encode)
[{"id":42535,"value":"AUTOMOBILES & COMPONENTS","type":"industries"}]
的PHP脚本。OUPUTS JSON:
public function renderJSON($data){
header('Content-type: application/json');
echo json_encode($data);
}
下一次做,考虑你的工作语言标记您的问题:PHP。这有助于PHP人员更轻松地找到您的问题。 – htxryan
我一定会做! – Marcus