简体   繁体   中英

Javascript function does not work after page loaded via Jquery Ajax request

But here's the crazy thing, this only happens with Safari. The function works as it should on Chrome, IE< and Firefox.

I tried adding:

$(document).ajaxComplete(function() {
    var myfunctionhere = function()
      {
      //my function
      }
});

Anyone got any ideas what is going on with Safari here and how I can get it to play nice.

The solution was to get rid of everything but the script and the content inside of the body - remove the html, head, and body tags.

This was also addressed here JavaScript doesn't execute in Safari when loading entire page via jQuery's load() method

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