title: Send JSON object to new page with jQuery
body: <p>I'm trying to send JSON data (demographics) to a new page (within the same directory) when a user clicks the marker I've placed on a google map on my page.
  I'm using the jquery-ui-map plugin right now and the marker and click event works fine but as you can see in the code, I'm trying to transfer a JSON object to the next page (demo-data.html). I tried using $.ajax but ran into the CORS issue.</p>
  
  <p>So my question is, how can I send that JSON array to the next page and then retrieve it when the next page (demo-data.html) loads so I can place the text into the appropriate places?</p>
  
  <p>PS - I'm not able to use server-side scripting</p>
  
  <p>Thanks!</p>
  
  <pre><code>$(document).bind('pageshow', function () {
    var mapdata = { destination: new google.maps.LatLng(59.3327881, 18.064488100000062) };
    var demographics =
    {
      city: 'Stockholm',
      county: '',
      state: 'Germany',
      lat: 59.3327881,
      long: 18.064488100000062,
      type: 'Standard',
      population: 1000000,
      housing: 800000,
      income: 50000,
      landarea: 1000000,
      waterarea:10000,
      decomissioned: 'No',
      militarycodes: ''
    };
  
    $('h1').text('Stockholm, Germany');
  
    $('#map_canvas').gmap(
      {
          'center' : mapdata.destination,
          'zoom' : 12
      })
      .bind('init', function(evt, map) {
          $('#map_canvas').gmap('addMarker',
              {
                  'position' : map.getCenter(),
                  'animation' : google.maps.Animation.DROP
              }, function(map, marker) {
                  $(marker).click(function() {
  
                      $.ajax({
                          url: 'demo-data.html',
                          type: 'POST',
                          data: JSON.stringify(demographics),
                          contentType: 'application/json; charset=utf-8',
                          dataType: 'json',
                          async: false,
                          success: function(msg) {
                              alert(msg);
                          }
                      });
                  });
              });
        });
  });
  </code></pre>