Search code snippets, questions, articles... Chrome Extension

JQuery Ajax post request with form data

The below code can be useful to send ajax post request with form data using jQuery.
var form_data = new FormData();    
form_data.append( 'username', 'John Deo');
form_data.append('email', 'info@devsheet.com');

$.ajax({
    url: 'api_url/endpoint',
    data: fd,
    processData: false,
    contentType: false,
    type: 'POST',
    success: function(response){
        console.log(response);
    }
});
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Was this helpful?
0 Comments
Join Devsheet Ask a Question