Submit files using jQuery Ajax

1 Min. Read
Sep 25, 2014

 Rails Ruby JS jQuery AJAX Form

Ajax

Ajax is a lot of web improvement procedures utilizing many web innovations on the customer side to make offbeat web applications. With Ajax, web applications can send and recover information from a server non-concurrently (out of sight) without meddling with the presentation and conduct of the current page. By decoupling the information trade layer from the introduction layer, Ajax permits website pages and, by augmentation, web applications, to change content powerfully without the need to reload the whole page by and by, current usage generally use JSON rather than XML.

Ajax is a set of web development techniques using many web technologies on the client side to create asynchronous web applications. With Ajax, web applications can send and retrieve data from a server asynchronously without interfering with the display and behavior of the existing page.

Simple example

1
2
3
4
5
6
$.ajax({
  url: "test.html",
  context: document.body
}).done(function() {
  $( this ).addClass( "done" );
});

How?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$('#myForm').submit(function(e){
     e.preventDefault();
    //Submit the form via ajax
    var formData = newFormData(this);

     $.ajax({
        url: $(this).attr("action"),
        type: "post",
        data: formData,
        cache: false,
        contentType: false,
        processData: false,
        success:function(response){
            //Success Job }
        });
})

You might also like

Submit Files Using J Query Ajax 

ShivaShiva Bhusal (Software Engineer) 1 Min. Read Sep 25, 2014
 Rails Ruby JS jQuery AJAX Form

Submit form data via AJAX using jQuery
Read More..


Write To Me

Hire me shiva bhusal
We'll never share your email with anyone else.
I'll never share your email with anyone else.