title: Retrieve PHP Variables with ajax load function
body: <p>I have an index.php with this code</p>
  
  <pre><code>&lt;div id="example" class="functions"&gt;&lt;/div&gt; 
  &lt;script type="text/javascript"&gt;
  var ajax_load = "&lt;img class='loading' src='ajax-loader.gif' alt='loading...' /&gt;";
  var loadUrl = "checks/example.php";
  $("#example").load(loadUrl);
  &lt;/script&gt;
  </code></pre>
  
  <p>and in the checks/example.php file</p>
  
  <pre><code>$masterurl = $_POST['domain'];
  echo $masterurl;
  </code></pre>
  
  <p>First Problem: the example.php can´t retrieve the $_POST Request, because ajax is outputting it like html. I have looked for JSON solutions - but not found anything for my problem.</p>
  
  <p>Second Problem: if the index.php outputs the value from example.php, how can I take the value and from the  and handle the value as another php variable? like</p>
  
  <pre><code>$value = [value from &lt;div id="example"&gt;&lt;/div&gt;]
  </code></pre>
  
  <p>UPDATE: First Problem resolved</p>
  
  <pre><code>&lt;div id="example" class="functions"&gt;&lt;/div&gt; 
  &lt;script type="text/javascript"&gt;
  var ajax_load = "&lt;img class='loading' src='ajax-loader.gif' alt='loading...' /&gt;";
  var loadUrl = "checks/example.php?domain=http://www.example.com";
  $("#example").load(loadUrl);
  &lt;/script&gt;
  
  
  $masterurl = $_GET['domain'];
  echo $masterurl;
  </code></pre>
  
  <p>but how can I take the value $masterurl in the index.php for a variable on the index.php?</p>
  
  <p>UPDATE 2:
  checks/example.php sends the following value = 35234 this value will be displayed in this div</p>
  
  <pre><code>&lt;div id="example"&gt;35234&lt;/div&gt;
  </code></pre>
  
  <p>how can I use this value on the same page for </p>
  
  <pre><code>&lt;?php
  $newvalue = "35234" // value from div id example
  ?&gt;
  </code></pre>