I would like to pass form data via jquery to a php page. Now I am little confused with image passing through jquery and how it will reach php page.
My code:
<script>
  $(document).ready(function() {
      $('form').submit(function(event) { //Trigger on form submit
        $('#name + .throw_error').empty(); //Clear the messages first
        $('#success').empty();
        var guestbookSendMessage = { //Fetch form data
          'name'  : $('input[name=name]').val(), //Store name fields value
        'msg': $('textarea[name=msg]').val()
         'file' :$("#fileInput")[0].files[0];
        };
        $.ajax({ //Process the form using $.ajax()
          type    : 'POST', //Method type
          url     : 'php/process.php', //Your form processing file url
          data    : guestbookSendMessage, //Forms name
          dataType  : 'json',
          success   : function(data) {
          if (!data.success) { //If fails
            if (data.errors.name) { //Returned if any error from process.php
              $('.throw_error').fadeIn(1000).html(data.errors.name); //Throw relevant error
            }
          } else {
              $('#success').fadeIn(1000).append('<p>' + data.posted + '</p>'); //If successful, than throw a success message
            }
          }
        });
          event.preventDefault(); //Prevent the default submit
      });
    });
</script> 
 
     
     
    