简体   繁体   中英

Google maps api not working on postback

I am using google maps API to load streets in a textbox.It is working properly.My problem is that on postback the initialize method in javascript is not working and data is not loading

I am using

function initialize() {
            //my code
             }
             google.maps.event.addDomListener(window, 'load', initialize);

Please help me

You will need to re-initialize the map on post-back as the code will not run again. If you are using an UpdatePanel a way to do this would be to bind to the end_RequestHandler ie

var prm = window.Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(endRequestHandler);

function endRequestHandler()
{
    // Initialize the map again
}

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