我的代码有问题,我不明白从 jquery 向控制器发送多个参数这是我的路线Route::get('/listcdix/{id}/detail/{asnumber}', ['as' => 'remindHelper', 'uses' => 'ListcdixController@detail']);下面是我的 jqueryotable.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这是我这样的网址http://127.0.0.1:3232/listcdix/+custcode+/detail/+asnumber+请检查我的照片
3 回答
![?](http://img1.sycdn.imooc.com/5458477f0001cabd02200220-100-100.jpg)
沧海一幻觉
TA贡献1824条经验 获得超5个赞
window.location = "{{route('remindHelper',['id'=>custcode,'asnumber'=>asnumber])}}";
试试这个希望它有效
![?](http://img1.sycdn.imooc.com/54584dd900014f6c02200220-100-100.jpg)
DIEA
TA贡献1820条经验 获得超2个赞
你可以使用这样的东西
window.location = "{{route('remindHelper',['id'=>"custcode",'asnumber'=>"asnumber"])}}";
因为在 Laravel 中使用花括号 {{}} 时。您不需要将其与 ++ 连接。这就是为什么您可以将其用作简单格式的原因。我也已经检查了这段代码,所以这对你来说是 100% 的工作。
谢谢你。
![?](http://img1.sycdn.imooc.com/54586425000103f602200220-100-100.jpg)
收到一只叮咚
TA贡献1821条经验 获得超4个赞
不幸的是,据我所知,您无法将 js 变量与 php 代码结合使用,并且您正在使用路由函数,并且由于您的路由需要处理参数,因此您需要在“路由”函数中传递变量。据我所知,没有办法,你必须以完整的字符串方式给出路线,如下所示:
let route = "/listcdix/" + custcode + "/detail/" + asnumber
添加回答
举报
0/150
提交
取消