This question already has answers here:
What is the difference between client-side and server-side programming?
(4个答案)
4年前关闭。
这是我的代码,在“ View ”中,我这样写:
JS:
我应该将返回的值从此javascript传递到 Controller 文件。
我该怎么办,请有人帮我...
在contoller的另一侧,您可以使用
希望这可以帮助
(4个答案)
4年前关闭。
这是我的代码,在“ View ”中,我这样写:
JS:
$(document).ready(function()
{
$( ".iCheck-helper" ).on( "click", function(){
console.log($('.i-check:checked').map(function() {
//alert(this.value);
return this.value;
}).get().join(', '));
}) ;
});
我应该将返回的值从此javascript传递到 Controller 文件。
我该怎么办,请有人帮我...
最佳答案
您可以使用ajax
请求发送所需的值:
$(document).ready(function()
{
$( ".iCheck-helper" ).on( "click", function(){
var value_to_send = $('.i-check:checked').map(function() {
return this.value;
}).get().join(', '));
$.get('route_to_your_action', {value_name: value_to_send},function(data) {
//data contain response from controller action
alert(data);
})
});
});
在contoller的另一侧,您可以使用
Input
获得值passe:use Illuminate\Support\Facades\Input;
.
.
.
function postHotelresults(){
$value_name = Input::get('value_name');
}
希望这可以帮助
08-06 09:52