title: jQuery AJAX removes Javascript on Phonegap
body: <p>I'm writing an app using jQuery and Phonegap</p>
  
  <p>On my javascript code I call $.ajax to request some of the app's sections to my web server. These sections are basically html snippets that I insert into the DOM. These snippets contain javascript code relevant to the section itself (which is dynamically built, thats why I don't include it on the app's main js file)</p>
  
  <p>I'm calling these sections using this code:</p>
  
  <pre><code>//...
  $.ajax(
              url,
              {
                  type: 'GET',
                  success: function(data){
                      $('#content').html(data);
                  },
                  error: function(jqXHR, textStatus, errorThrown) {
                      //...
                  }
              });
  //...
  </code></pre>
  
  <p>The data returning from the web server looks something like:</p>
  
  <pre><code>&lt;div&gt;...&lt;div&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function() {
     //some code to be executed when this section loads
     //this is dynamically generated
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Now, the problem is that when this code executes, it does not insert the SCRIPT tag into the DOM (only the html part).</p>
  
  <p>This runs just fine on Chrome but when I test it on the emulator (using Ripple) does not.</p>
  
  <p>I think it may be a security check but not sure on this.</p>
  
  <p>My config.xml has this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;widget xmlns="http://www.w3.org/ns/widgets" 
          xmlns:gap = "http://phonegap.com/ns/1.0" 
          version="0.1.1"
          versionCode="1"
          id="com.company.prod"&gt;  
      &lt;name&gt;...&lt;/name&gt;
      &lt;author&gt;...&lt;/author&gt;
      &lt;description&gt;...&lt;/description&gt;
  
  
  
      &lt;gap:splash src="splash.png" /&gt;
  
      &lt;content src="index.html"/&gt;
      &lt;access uri="*" subdomains="true"/&gt;
  
      &lt;feature name="http://api.phonegap.com/1.0/battery"/&gt; 
      &lt;feature name="http://api.phonegap.com/1.0/geolocation"/&gt; 
      &lt;feature name="http://api.phonegap.com/1.0/network"/&gt;
      &lt;feature name="http://api.phonegap.com/1.0/notification"/&gt;
  
  &lt;/widget&gt;
  </code></pre>
  
  <p>Any idea why this happens?</p>