php - 如何为ajax url laravel调用控制器功能
问题描述
我正在通过 ajax url 从视图(resources\views\customer\edit_order.blade.php)使用控制器(OrdersController)的功能(交付更新)。我的 javascript 位于localhost:8072/myapp/public/theme/js/custom.js
$.ajax({
url: 'delivery-update',
type: "POST",
.....
但是当我在网络控制台中调试 url 时。请求将发送到 urllocalhost:8072/myapp/customer/edit_order/delivery-update
但我需要 url 请求localhost:8072/myapp/orders/delivery-update
我试过了,
url: 'orders/delivery-update' //but it takes to localhost:8072/myapp/customer/edit_order/orders/delivery-update
我的路由.php
Route::post('orders/delivery-update', 'Admin\OrdersController@delivery_update');
请。任何建议都会很棒..
解决方案
推荐阅读
- python-3.x - 如何在 python3 中使用带有非捕获组的正则表达式替换?
- docker - Docker 映像在 macOS 中有效,在 Raspberry 中无效
- visual-studio - 如何恢复 Visual Studio 比较/合并工具?
- c# - 将 DUO WEB 与 .NET 核心集成
- python - Numpy 数组对象或数据结构
- c# - 单击以打开面板并在面板打开时再次单击以关闭 unity2d ui c#
- azure-devops - Azure Devops Web 扩展用户首选项/设置存储
- java - Java Spring管道远程文件成分段上传
- android - 如何从 chrome://sync-internal 调用的转储中破译访问 URL 的时间
- swift - 如何在 ForEach 循环中获取计数变量