weixin_33697898 2017-05-23 17:36 采纳率: 0%
浏览 33

如何在Laravel中使用Ajax?

Guys i have made a blog using Laravel framework, today I just heard about ajax, What I heard is in short: it loads data quickly. My issue is that I have many routes , controllers with views.

What steps do i need to use so called ajax javascript?

  <script>

   $.ajaxSetup({
    headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') 
  }
  });

  jQuery.ajax({
    url:'/blog',
    type: 'GET',

    success: getIndex(  ){

        console.log( );
      },

  });

 </script>
  • 写回答

2条回答 默认 最新

  • weixin_33730836 2017-05-23 18:35
    关注

    Ajax can be used normally in Laravel, I particularly usually host my codes in '/ public / js' and then extend through the <script> so that the code is not mixed. I advise you to study Laravel's structure, read the documentation, see some videos. Your question is very broad, so I will leave some materials that are of interest to you.

    Book by Novatec about Ajax:

    https://www.novatec.com.br/livros/ajaxjquery/

    Laravel Docs:

    https://laravel.com/docs/5.4/

    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?