我的 View 中有一个数据,例如
<input name="start" type="hidden" value="1" />
<input name="end" type="hidden" value="2" />
当我的页面加载时,我需要将此值传递给 Controller 。
我应该如何将它传递给 Controller 。
有没有办法使用 jQuery 发送这个值!!!...
谁能帮帮我..
最佳答案
为什么不尝试ajax
?
<input name="start" class="start" type="hidden" value="some_value1" />
<input name="end" class="end" type="hidden" value="some_value2" />
var postData = {
"param1" : some_value1,
"param2" : some_value2
};
console.log(postData);
$.ajax({
type: "POST",
url: "test.php",
data: postData,
success: function(){
alert(param1 + ' ' + param2);
window.open("test.php");
}
});
test.php
是您的 Controller ...
关于php - 如何在 Laravel 5 中将输入类型隐藏值从 View 传递到 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36424349/