develog

[jquery] ajax 본문

카테고리 없음

[jquery] ajax

냐옴 2022. 10. 26. 22:57

 

let url = '/api/members';
let data = {
    memberName: 'memberA'
};
let headers = {
    'Authorization': 'Bearer token',
    'Content-Type': 'application/json',
}

$.ajax({
    url: url,
    method: 'post',
    headers: headers,
    data: data,
    dataType: 'json',
    async: true,
    traditional: true,
    beforeSend: function(xhr) {

    },
    success: function(data, textStatus, jqXHR) {

    },
    error: function(jqXHR, textStatus, errorThrown) {

    },
    complete: function(jqXHR, textStatus) {

    }
});

 

https://api.jquery.com/jQuery.ajax/

 

jQuery.ajax() | jQuery API Documentation

Description: Perform an asynchronous HTTP (Ajax) request. The $.ajax() function underlies all Ajax requests sent by jQuery. It is often unnecessary to directly call this function, as several higher-level alternatives like $.get() and .load() are available

api.jquery.com

 

Comments