【发布时间】:2015-02-27 06:09:42
【问题描述】:
这是我在页面中使用的 javascript 代码。
<script>
$(document).ready(function() {
$("#tokenfield").tokenInput("localhost/inkrasa3/public/hashes",
{theme:"facebook",tokenLimit:5,preventDuplicates:true,tokenValue:"name"});
});
</script>
这是路由文件。
Route::get('hashes',function(){
return "[{id: 1, name:\"hello\"},{id:2, name:\"sup\"}]";
});
我做错了什么?它非常适合硬编码数组或刀片打印的 Json 数组。
我什至试过这个:
$(document).ready(function() {
$("#tokenfield").tokenInput("localhost/inkrasa3/public/hashes",
{theme:"facebook",tokenLimit:5,preventDuplicates:true,tokenValue:"name",method:"post"});
});
与路线:
`Route::post('hashes',function(){
$names[] = array('id' => 0, 'name' => 'hello');
$names[] = array('id' => 1, 'name' => 'sup');
return Response::json($names);
});` 当我查看浏览器开发工具时,这两次都出现 404 错误。
【问题讨论】:
-
当我从浏览器中的选项卡发送相同的网址时,一切正常。但是搜索栏出现 404 错误。希望这些信息对您有所帮助。
标签: php laravel jquery-tokeninput