jquery - IE document.ready() not triggered after ajax request -
document.ready() not triggered after ajax request in ie work charm in ff , chrome. have 2 files. first file(test.jsp) has submit button. onclick loads struts second file(result.jsp). . 2 files
test.jsp
<html> <head> <script type="text/javascript" src="/js/jquery-1.2.6.min.js"/></script> <script type="text/javascript" src="/js/api.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#test").click(function() { var path = "/testajax.do" $.get(path,function(data) { document.write(data); }); }); }); </script> </head> <body> <div><h3>hello world</h3><br/> <input type="button" id="test" value="submit"/> </div> </body> </html>
result.jsp
<html> <head> <script type="text/javascript" src="/js/jquery-1.2.6.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ alert("success"); }); </script> </head> <body> <div><h3>result</h3><br/> <!--input type="button" id="test" value="submit"/--> </div> </body> </html>
when result.jsp loads alert("success"); called.... works in ff , chrome. not in ie. alert doesnt pop up. displays error object expected document.ready() line. works if refresh page....
any appreciated...
when ajax-request add random number/string parameter ajax url. fixed ie related errors because forces ie load reload page , not use 1 cache.
Comments
Post a Comment