简体   繁体   中英

call a twig function (render) with ajax

I have in my template a twig call :

{{ render(controller( 'MyApplicationBundle:Application:timeline', { 'number': '0-10' } )) }}

So, with this line, i call my action timeline , retrieve the last 10 posts of my timeline, call my view timeline.html.twig and display them.

I need, when the user scroll to the bottom of the page for example, re-call this line and change the parameter number (with 10-20) for retrieve other posts and re-display them.

My question, how can i call this line (render(controller))) with ajax and display the response on my page ?

Why do you need to call render(controller) from js? You can simply call MyApplicationBundle:Application:timeline by his url? What the problem?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM