我试图将数据从视图传递给我的控制器,但我无法让它工作,我在CodeIgniter中使用了相同的sintaxe,它工作得非常好!蚂蚁帮手?
function Navigation() {
$(".getDataId").on("click", function(){
var dataId = $(this).attr("data-id");
jQuery.ajax({
type: "POST",
url: 'http://localhost/test/test/nav',
data: {DataId: dataId},
success: function (response) {
console.log("success");
console.log(response);
},
error: function(response){
console.log("error");
console.log(response);
}
});
});
}
当我记录数据时,它为我提供了对象对象
> {\n \"message\": \"\",\n \"exception\":
> \"Symfony\\\\Component\\\\HttpKernel\\\\Exception\\\\NotFoundHttpException\",\n
> \"file\":
> \"C:\\\\wamp64\\\\www\\\\Simples\\\\vendor\\\\laravel\\\\framework\\\\src\\\\Illuminate\\\\Routing\\\\RouteCollection.php\",\n
> \"line\": 179,\n
更新:
这是我的路线:我还不太明白!
Route::get('/', 'test@index');
在我的控制器中,索引函数从数据库中获取一些数据,并使用:return view
将其发送到视图。
发布于 2019-10-06 18:33:09
Codeigniter和Laravel是两个不同的框架。在codeigniter中,您不需要首先为任何http请求定义路由。但在laravel中,您必须在web.php文件中定义要发出的每个请求。
https://stackoverflow.com/questions/58254616
复制相似问题