Friday, May 24, 2013

How to dynamically load a gwt generated nocache.js file?

I would like to load a GWT generated foo/foo/nocache.js file dynamically by using JQuery. SomeHow this foo/foo/nocache.js file is not executed by the browser. If I put the script normally by using GWT style withOut using the JQuery, then after the page is loaded it is generating a script(ie.., jquery.onInjectDone('jquery') ) dynamically. Now if I create this script tag using JQuery or javaScript then it is not generating the dynamically generated script. Now How can I make sure thatfoo/foo/nocache.js is executed using JQeury?.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>  <html>   <head>    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">     </script>    <script>     $(document).ready(function() {     $("#clickMe").click(function() {     // This /foo/foo.nocache.js which is generated by GWT compiler.         $.getScript("/foo/foo.nocache.js", function(data, textStatus, jqxhr) {             console.log(data); //data returned             console.log(textStatus); //success             console.log(jqxhr.status); //200             console.log('Load was performed.');          });      });     });     </script>   </head>   <body>     <h1>Web Application Starter Project</h1>      <a href="#" id="clickMe">clickMe</a>      <div id="name">      </div>         </body>  </html>
output: ReferenceError: foo is not defined

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment