title: Get variable from PHP file using JQuery/AJAX
body: <p>This is my first post here and I hope that someone will be able to help me.
  For the past week I have been working on a project of mine. Apparently, I have stuck with the last part.<br>
  So basically, I have an AJAX chat and when I submit a line I send (using a Post method) the whole line to be analyzed (to a file named analysis.php).<br>
  The chat line is being analyzed and find the variable I needed by doing queries on a MySql Database.<br>
  All I need now, is to have this variable taken with JQuery-AJAX and put it on a div in my html file(so it can be displayed on the right-left-whatever of the chat). </p>
  
  <p>Here are my files :<br>
  <strong>analysis.php</strong><br>
  </p>
  
  <pre><code>&lt;?php
  $advert = $row[adverts];
  ?&gt;
  </code></pre>
  
  <p><strong>ajax-chat.html</strong>   </p>
  
   
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;AJAX Chat&lt;/title&gt;
  
  &lt;link rel="stylesheet" type="text/css" href="js/jScrollPane/jScrollPane.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/page.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/chat.css" /&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div id="chatContainer"&gt;
  
      &lt;div id="chatTopBar" class="rounded"&gt;&lt;/div&gt;
      &lt;div id="chatLineHolder"&gt;&lt;/div&gt;
  
      &lt;div id="chatUsers" class="rounded"&gt;&lt;/div&gt;
      &lt;div id="chatBottomBar" class="rounded"&gt;
          &lt;div class="tip"&gt;&lt;/div&gt;
  
          &lt;form id="loginForm" method="post" action=""&gt;
              &lt;input id="name" name="name" class="rounded" maxlength="16" /&gt;
              &lt;input id="email" name="email" class="rounded" /&gt;
              &lt;input type="submit" class="blueButton" value="Login" /&gt;
          &lt;/form&gt;
  
          &lt;form id="submitForm" method="post" action=""&gt;
              &lt;input id="chatText" name="chatText" class="rounded" maxlength="255" /&gt;
              &lt;input type="submit" class="blueButton" value="Submit" /&gt;
          &lt;/form&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="js/jScrollPane/jquery.mousewheel.js"&gt;&lt;/script&gt;
  &lt;script src="js/jScrollPane/jScrollPane.min.js"&gt;&lt;/script&gt;
  &lt;script src="js/script.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>So, I am basically trying to get the $advert from the analysis.php file(after the whole analyze is done) , and by using JQuery/AJAX pass it eventually to the ajax-chat.html file.
  Any help is really appreciated. I have googled everything but haven't found something to help me.
  Thanks in advance.</p>