doucu5836 2018-01-20 11:33
浏览 46

在Laravel 5刀片模板中包含HTML文件

I have created a laravel app where I am loading the product list from database. I am able to get this list very easily with larvel.

I am facing problem while adding search box to blade page. Since, PHP is server side, whenever user chose a product in search box I have to hit server to get the same data for single product and refresh product list in blade page.

My query is, do I have the option of loading html files(partials) which I can load using blade view. My logic is using ajax call in html files to retrieve product list, store it at client side and perform client side operations.

I know I have option of using Angular with laravel but I don't need all functionalities and overhead(routes,directive,what not) of Angular.

  • 写回答

1条回答 默认 最新

  • duanbei2914 2018-01-21 06:56
    关注

    What problem are you facing, exactly? You're using ajax already, so just update the DOM when you receive your response. Include a partial view file with the HTML for a single item, but hide it until the user gets a single item, then show it and set the appropriate values.

    I don't particularly like that approach, however. That's a big reason what Vue, Angular, React, etc. are there for.

    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置