title: Modal form Submission to PHP using Jquery .ajax
body: <p>I am trying to post a modal form to a table using php, jquery .ajax but it never works.. tried debugging using firebug and i don't see any errors. i tested the form by using form action="notes_functions.php" and it worked fine.</p>
  
  <p>Profile.php</p>
  
  <pre><code>    &lt;div class="modal-body"&gt;
  
          &lt;form class="noteform" id="notesmodal" method="post"&gt;
             &lt;fieldset&gt;      
            &lt;label&gt;Title&lt;/label&gt;
                  &lt;input type="text" class="form-control" name="note_title" placeholder="Enter a title for your note"&gt;
                  &lt;label&gt;Note&lt;/label&gt;
                  &lt;textarea rows="4" cols="50" class="form-control" name="note_content" placeholder="note"&gt;&lt;/textarea&gt;
                  &lt;label&gt;Note type&lt;/label&gt;
                  &lt;div class="panel-body"&gt;
                      &lt;input type="tagsinput" id="teetete" class="tagsinput" value="" /&gt;
                  &lt;/div&gt;                                                  
                  &lt;label for="exampleInputFile"&gt;Attach a document&lt;/label&gt;
                  &lt;input type="file" id="exampleInputFile3"&gt;
                  &lt;p class="help-block"&gt;PDF, DOCX and image files are supported.&lt;/p&gt;
              &lt;div class="checkbox"&gt;
                  &lt;label&gt;
                      &lt;input type="checkbox"&gt; Check me out
                      &lt;input type="label" name="note_account" value="&lt;?php echo $acctname ?&gt;"/&gt; 
                  &lt;/label&gt;
              &lt;/div&gt;
              &lt;input type="hidden" name="note_creator" value="&lt;?php echo $_SESSION['username'];?&gt;"/&gt;
                &lt;/fieldset&gt;
               &lt;button class="btn btn-default" id="submitnote" &gt;ADD&lt;/button&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>this is my js code</p>
  
  <pre><code>$(function(){
    $("button#submitnote").click(function(){
      $.ajax ({
        type:"POST",
        url:"notes_functions.php",
        data: $('form.noteform').serialize(),
        success: function(msg){
          $("#thanks").html(msg)
          $("form.noteform").modal('hide');
        },
        error: function(){
          alert("failure");
        }
      });
    });
  });
  </code></pre>
  
  <p>notes_functions.php</p>
  
  <pre><code>&lt;?php
  
  include_once 'dbconnect.php';
  
  if (isset($_POST['note_title'])) {
  
  
  
          $notetitle = strip_tags($_POST['note_title']);
          $noteContent = strip_tags($_POST['note_content']);
          $noteAccount = strip_tags($_POST['note_account']);
          $noteCreator = strip_tags($_POST['note_creator']);
  
          mysql_query("INSERT INTO account_notes (note_title, note_contents, note_account, note_creator) 
              VALUES ('$notetitle','$noteContent', '$noteAccount', '$noteCreator') ");
  
          echo "Name = ".$notetitle;
          echo $noteCreator;
  
  
  
  
   }
  
  ?&gt;
  </code></pre>