Answers for "ajax send expect json"

3

how to set json type jquery ajax

$.ajax({
    type: "POST",
    contentType: "application/json",
    url: 'http://localhost:16329/Hello',
    data: { name: 'norm' },
    dataType: "json"
});
Posted by: Guest on June-30-2020
-1

jquery ajax promise

$.ajax({
    url: "/someurl",
    method: "GET",
    data: { 
      a: "a"
  })
  .done(function(data) {
    console.log('success callback 1', data) 
  })
  .done(function(data) {
    console.log('success callback 2', data) 
  })
  .fail(function(xhr) {
    console.log('error callback 1', xhr);
  })
  .fail(function(xhr) {
    console.log('error callback 2', xhr);
  });
Posted by: Guest on September-08-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language