title: Display success message in popup dialog after form submit
body: <p>I am new to jQuery. I want to open a form in a popup dialog. When the user submits the form data should be inserted into MySQL database &amp; success message should be displayed in the dialog.</p>
  
  <p>I could do dialog with form but how to load success message?</p>
  
  <pre><code>&lt;head&gt;
      &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css"&gt;
      &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
      &lt;script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;button id="dialog_trigger"&gt;open the dialog&lt;/button&gt;
      &lt;div id="dialog" style="display:none;" title="Dialog Title"&gt;
          &lt;form id="form1"&gt;
              &lt;input type='text' name='data' id='data'/&gt;
              &lt;input type='submit' id='submit'/&gt;
          &lt;/form&gt;
      &lt;/div&gt;
      &lt;script&gt;
          $( "#dialog_trigger" ).click(function() {
              $( "#dialog" ).dialog( "open" );
          });
          $("#dialog").dialog({
              autoOpen: false,
              position: 'center' ,
              title: 'EDIT',
              draggable: false,
              width : 350,
              height : 200, 
              resizable : true,
              modal : true,
          });
          $( "#submit" ).click(function() {
          // help    
          });
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>$data=$_REQUEST['data'];
  $q= mysqli_query($c,"INSERT INTO report (data) VALUES ('$data')") or die(mysqli_error());
  if($q){
      echo "Your report is submitted!"; //this should appear in popup dialog
  }
  </code></pre>