umerata
8/11/2017 - 10:17 AM

Jquery Ajax Request | label-js

Jquery Ajax Request


// Simple Ajax Request

$.ajax({
          type: 'POST',
          url: 'SCRIPT.php',
          data: $("#FORM").serialize(),
          dataType: "json",
          cache:false,
          success:function(response){
            
          }
  })
  
  
// Ajax Request for uploading files too 

var myform1 = $('#empForm1')[0];
var myformData1 = new FormData(myform1);

$.ajax({  
              type: "POST",
              url: "php_scripts/ajax_calls/update_emp_data.php",
              data: myformData1,
              contentType: false,
              processData:false,
              dataType: "html",                   
              success: function(response){
                  
              }
    });



//   You can also send data like this
data: { name: "John", location: "Boston" }