javascript - 如何将值多个参数从 jquery 传递到 laravel 控制器?
问题描述
我的代码有问题,我不明白如何将多个参数从 jquery 发送到控制器
这是我的路线
Route::get('/listcdix/{id}/detail/{asnumber}',
['as' => 'remindHelper', 'uses' => 'ListcdixController@detail']);
下面是我的jQuery
otable.on("click", ".btnview",
function () {
var custcode = otable.rows($(this).closest("tr")).data()[0].CustCode;
var asnumber = otable.rows($(this).closest("tr")).data()[0].ASNumber;
window.location = "{{route('remindHelper',['id'=>"+custcode+",'asnumber'=>"+asnumber+"])}}";
});
但是当我单击此按钮时无法获得价值custcode
并且asnumber
这是我的网址
感谢您的关注
解决方案
你可以使用类似的东西
window.location = "{{route('remindHelper',['id'=>"custcode",'asnumber'=>"asnumber"])}}";
因为在 laravel 中使用花括号 {{}} 时。您不需要将其与 ++ 连接。这就是为什么您可以将其用作简单格式的原因。我也检查了这段代码,所以这对你来说是 100% 的。
谢谢你。
推荐阅读
- github - 卡在 GitHub Actions 中使用 PAT(个人访问令牌)
- node.js - AWS Lambda - 发送带有证书的 GET 请求
- sql - 如何根据类型列计算交易余额
- c# - 快速反序列化或持久化自定义对象列表
- arrays - 如何合并两个排序数组?
- python - 使用 openCV 检测透明度/玻璃透明度
- python - Python SQLAlchemy 错误:ModuleNotFoundError:没有名为“mysql”的模块
- visual-studio - 如何仅对项目中的几个文件禁用 Visual Studio 自动格式化
- javascript - 比较文本并突出显示 react-native 中的差异
- amazon-web-services - Amazon S3 存储桶 - 此 XML 文件似乎没有任何关联的样式信息