title: Load a data from a page to another page using jquery ajax
body: <p>I have two pages, <strong>index.php</strong> and <strong>block1.php</strong>
  I wanted to load a data from block1.php to a div #details in index.php</p>
  
  <p>here's my code</p>
  
  <blockquote>
    <p>index.php</p>
  </blockquote>
  
  <pre><code>&lt;div id="pop_box"&gt;
    &lt;div class="close"&gt;&lt;span id="close"&gt;&amp;times;&lt;/span&gt;&lt;/div&gt;
    &lt;div id="block"&gt;&lt;/div&gt;
    &lt;div id="details"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <blockquote>
    <p>block1.php</p>
  </blockquote>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function() {
    var lnk;
    $('[href]').click(function() {
      lnk = '';
      lnk = $(this).attr('href');
      if (lnk.charAt(1) == "b") {
        var lot = lnk;
        $.ajax({
          url: "2dmap_func.php",
          method: "POST",
          dataType: "text",
          data: {
            lot: lot
          },
          success: function(data) {
            //alert(data);
            $('index.php #pop_box #details').load(data);
          }
        });
      }
    });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>as you can see I want to load the data from block1.php to index.php's div#details and this code doesn't work.</p>
  
  <pre><code> $('index.php #pop_box #details').load(data);
  </code></pre>