title: Make my jQuery Ajax script use CORS
body: <p>I built an application which reads data via AJAX from an external website. It works fine but I found out in another <a href="https://stackoverflow.com/a/10881561/773263">question</a> that if I want to package it for BlackBerry 7, with Webworks or Phonegap, I may need to use something called <a href="http://www.w3.org/TR/cors/" rel="nofollow noreferrer">CORS</a>.</p>
  
  <p>How can I convert my following script to do the same thing except using 'CORS'?</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
          $("#page_all").live('pagebeforecreate', function() {
          $.get('http://mysite.com/mobile/data/data_all.php',function(data){
              $('.content').empty();
              $(data).find('market').each(function(){
                  var $market = $(this);
                  var html = '&lt;div class="data"&gt;';                      
                  html += '&lt;div data-role="collapsible" data-collapsed="true" data-theme="b"&gt;&lt;h3&gt;' + $market.attr('date') + '&lt;/h3&gt;';
                  html += '&lt;/div&gt;';
                  $('#result').append(html).trigger( "create" );
                  $('#result .loading').remove();
              });                        
          });
          });
      &lt;/script&gt;
  </code></pre>