title: CodeIgniter and AJAX form submit
body: <p>I am trying to save data submitted from a form into my mysql database and and then update the div element with the last posted item prepended to the list in the div.</p>
  
  <p>Right now I am only trying to get a response back, I'm not worried about having the formatting correct at the moment.</p>
  
  <p>My problem is the form won't submit with <code>e.preventDefault();</code> in place, but without it the form does the normal method of posting to the db then refreshing the page.</p>
  
  <p>Here is my AJAX call:</p>
  
  <pre><code>$(document).ready(function() {
  
      $('form#feedInput').submit(function(e) {
  
          e.preventDefault();
  
          $.ajax({
              type: "POST",
              url: "&lt;?php echo site_url('dashboard/post_feed_item'); ?&gt;",
              data: $('.feed-input').val(),
              dataType: "html",
              success: function(data){
                  debugger;
                  $('#feed-container').prepend(data);
              },
              error: function() { alert("Error posting feed."); }
         });
  
      });
  });
  </code></pre>
  
  <p>I don't think it's necessary for me to post my controller code, seeing as how my issue is the form won't make it past the <code>e.preventDefault();</code> function.</p>
  
  <p>How can I get this form to submit via AJAX if the <code>e.preventDefault()</code> function is stopping it before it can reach the <code>$.ajax()</code> function?</p>