LarsWiegers/laravel-maps

call x-maps-google with ajax

Closed this issue · 5 comments

Hello and thank you very much for the effort you put in this package.
I am trying to implement the map in the following scenario.
A specific user interaction makes an ajax call to a route. From there the controller handles the request by returning a small blade with some information. The controller is using the return view() to send back the blade. Inside this blade I have the .
When the ajax request returns, javascript handles it by applying the blade to a div element.

When doing this, the map is not rendered.

I notice that if the is rendered onpageload , it pushes some scripts to html .
But if the is being rendered afterwards through ajax, the snippets are not pushed to

Am I approaching this the wrong way? Do you have any suggestions on how to initialize the map asynchronously maybe?

Thank you for your time.

Hi, thx for the issue :)

Could you setup a repository with a basic example of what you want?
I kinda understand it but having a level playing ground would help.

Hello.
https://github.com/sotirislp/test
this is a test repository that has the exact thing I want to achieve.
Thank you very much for your time.

Hi thank you for making the repository. as I understand it now this will never work. That is because the google and leaflet are listening for a document created event which is never fired when loading it via this.

What you could try is loading it via an iframe and using the js in the page to reload the iframe.

This is a very good solution actually. Thank you very much! You made my day :)

Alright, good luck :)