jquery
$.ajax jQuery
$.ajax({
url: 'YourRestEndPoint',
method: 'POST',
headers: {
'Authorization':'Token xxxxxxxxxxxxx',
'Content-Type':'application/json'
},
data: { "key": "value" },
dataType: 'application/json',
processData: false, //IF YOU ARE SENDING FORM DATA
contentType: false,
success: function(data){
console.log('success: ', data);
},
error: function(data) {
console.log('error: ', data);
}
});
Above is the code snippet to send ajax request using jQuery.Â
Was this helpful?
Similar Posts