title: How to send and retrieve cross-domain ajax data in userscript
body: <p>I use this code to store and retrieve ajax data via <a href="http://openkeyval.org/" rel="nofollow noreferrer">http://openkeyval.org/</a></p>
  
  <pre><code> $.ajax({    /*   send data    */
          url: "http://api.openkeyval.org/store/",
          data: "test-key-data=" + JSON.stringify([123,456]),
          dataType: "jsonp",
          success: function(data){
              console.log(data);
          }
   }); 
  
  $.ajax({     /*   retrieve data     */
          url: "http://api.openkeyval.org/test-key-data",
          dataType: "jsonp",
          success: function(data){
              console.log(data);
          }
   }); 
  </code></pre>
  
  <p>everything work fine in Chrome javascript console but in <strong>userscript</strong> I get error like this<br></p>
  
  <blockquote>
    <p>Uncaught ReferenceError: jQuery110208458673823624849_1375932537303 is
    not defined</p>
  </blockquote>
  
  <p>I try to use <strong>GM_xmlhttpRequest</strong> to retrieve data like this </p>
  
  <pre><code>GM_xmlhttpRequest({
      method: "GET",
      url: "http://api.openkeyval.org/test-key-data",
      onload: function(response) {
          console.log(response.responseText);
      }
  });
  </code></pre>
  
  <p>but it seem like openkeyval doesn't accept data via POST/GET method and log result was like when you access it directly from url of browser like <a href="http://api.openkeyval.org/test-key-data" rel="nofollow noreferrer">this</a> </p>
  
  <blockquote>
    <p>{"error":"not_found","documentation_url":"http://openkeyval.org/"}</p>
  </blockquote>
  
  <p>I include <strong>jQuery</strong> and it work fine with this code<br>
  <code>// @require            http://code.jquery.com/jquery-latest.min.js</code></p>
  
  <p>I try to use <a href="https://stackoverflow.com/questions/1647519/jquery-getjson-inside-a-greasemonkey-user-script#answer-1658307">Greasemonkey/jQuery XHR bridge</a> with out change other code by like this<br>
   <code>// @require           http://courses.ischool.berkeley.edu/i290-4/f09/resources/gm_jq_xhr.js</code></p>
  
  <p>and try use <strong>openkeyval official javascript library</strong> with code like this<br>
  <code>// @require            http://cdn.openkeyval.org/statics/openkeyval.packed.js</code>
  <br>and retrieve data with code like this</p>
  
  <pre><code>var ourCallback = function(value, key) {
    console('The value of ' + key ' + is ' + value);
  };
  window.remoteStorage.getItem('test-key-data', ourCallback);
  </code></pre>
  
  <p>still got error <code>ERROR: Unexpected string</code></p>
  
  <p>Please help, I mess with it more than 10 hours.<br> Thank you so much.</p>