【问题标题】:ajax get call is not working? it show the error not ajax call not foundajax get 调用不起作用?它显示错误不是找不到ajax调用
【发布时间】:2021-04-01 14:46:56
【问题描述】:

亲爱的,我在 laravel 的编辑页面中有一个 ajax 调用,我想从函数中获取指标这里是我的 ajax 调用

<script type="text/javascript">
$(document).ready(function(){
   var id = $('#activity').val();
     
     ajaxcall= $.ajax({
        url: 'editTreeView/'+id,
        type: 'get',
        dataType: 'json',
        
    success: function(response){

        alert(response);

          }});
      });
   </script>

它在我的控制台中显示以下错误 GET http://localhost:8000/activity/829a94e7-c282-4830-81fe-e93e1b1e6683/editTreeView/829a94e7-c282-4830-81fe-e93e1b1e6683 404(未找到) 其中 829a94e7-c282-4830-81fe-e93e1b1e6683 是 laravel 中的 UUID 我不知道如何向函数发送请求。有什么建议

【问题讨论】:

  • 试试url: '/editTreeView/'+id,,否则它是相对于当前页面的url,看起来是/activity/829a94e7-c282-4830-81fe-e93e1b1e6683
  • 我做了 url: '/editTreeView/'+id,但同样的错误 404

标签: jquery ajax laravel-routing


【解决方案1】:

它只是从我的路线中删除活动 Route::get('editTreeView/{id}', 'ActivityController@editTreeView');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 2018-09-28
    • 2013-05-24
    • 1970-01-01
    相关资源
    最近更新 更多