简体   繁体   中英

get the rendering of an html js in a controller (symfony2) before any action has been done

Could you please help me with this issue?

I have a js file that is connected to an API... it can get information about geolocalisation.

Anyway, I need to get this information in a symfony2 controller, but before any rendering (before the first rendering), any clues please?

PS : i could try file_get_contents , but this works with remote links, but not with a local file (where i put the html js). There is something I don't understant.

Thank you in advance for any help!

I guess you can follow this scenario :

  • A first action of your controller calls a page where js is and colls the api
  • This page then calls a second action of your controller (via window.location.href for example) and sends it the information, so the action can render what you want

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