【发布时间】:2013-06-11 18:47:39
【问题描述】:
我会准确地说:$.post jQuery 函数和我的控制器中的一个动作有一个奇怪的问题。我是 PHP 新手,但我以前使用过 ASP.NET MVC,我希望它们是相似的。问题来了:
//This is my ajax call
$.post('get_random_photos', count, function(data) {
...
});
//This is my action
public function post_get_random_photos($count) {
...
}
//This is what I have in my routes.php
Route::post('photos/get_random_photos', 'photos@get_random_photos');
当我发出 ajax 请求时,我收到以下消息:
Missing argument 1 for Photos_Controller::post_get_random_photos()
我知道这可能可以使用Input::get('count'); 解决,但我宁愿将count 作为操作参数,就像我以前在 ASP.NET MVC 中所做的那样。有没有办法做到这一点?
【问题讨论】:
标签: php jquery post laravel laravel-3