Laravel Routes/jQuery $.post() returning 404 Not Found
Laravel Routes/jQuery $.post() returning 404 Not Found
包含发送POST请求的jQuery的Javascript文件
$.post('sign_in', { email: email, password: password }, function(result) {
$('#sign_in_result').html(result);
console.log(result);
});
包含POST路由的Laravel routes.php文件。
<?php
Route::get('/', 'HomeController@showWelcome');
Route::post('sign_in', function() {
return 'Test';
});
不返回test,而是不返回任何东西。在控制台中显示404 Not Found.
POST http://localhost/project/public/sign_in 404 (Not Found)
尝试使用URL类来构建路由的URL,因此:
$。帖子(sign_in,…
就变成:
$。post('{{URL::to('sign_in')}}', ....
相关文章:
- jQuery is not loaded
- AngularJS JSON not arriving php
- $rootScope not working
- reactRedux is not defined
- jQuery document.ready not working
- Javascript/Jquery Blob not showing Chrome PDF
- ReferenceError: not defined
- ReferenceError: cordova is not defined @ng-cordova.min.js:7
- Javascript getElementsByTagName not working?
- jQuery's trim()的前缀为not运算符
- Javascript - element.childNodes does not see an append.newch
- SemanticUI模态not onDeny/onApprove事件未激发
- WebkitTransform not fluent
- JQuery.val( ) not working
- $routeParams not returning Object
- $.get not returning html
- this.href not returning href
- Laravel Routes/jQuery $.post() returning 404 Not Found
- jQuery AJAX not returning false
- XMLHTTPRequest Not returning