Using AJAX in a plugin to submit form – REALLY confused

Things you can check:

  1. View the page source, and look for your js files, if they’re included or not, and whether their order is proper.
  2. Use console.log(SwoonAjax.ajaxurl) to check if you’re getting the proper path in your js file.
  3. In Firebug, switch to Console tab, and then try firing your AJAX request. You’ll see the processing here, and errors, if any.
  4. Try using jQuery’s jquery.post method for AJAX. It’s easier.

These checks will help you identify the problem.

A quick tip: Change plugins_url('ds-swoons/js/swoon-ajax-form.js') to plugins_url('js/swoon-ajax-form.js', __FILE__), this will give you the correct plugin folder.

Leave a Comment