How to do an Ajax GET request to get data from rails and pass it to javascript(google maps)?

微笑、不失礼 提交于 2019-12-01 00:05:25

Oh I was able to find my way to get the list of locations. The controller and view are left untouched.

I added the following ajax in map.js which did the work for me.

$.ajax({
        type: "GET",
        dataType: "json",
        url: "/locations",
        success: function(data){}
    }); 

Now data can be passed to the marker object in google maps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!