Ajax() headers data type?

Ajax() headers data type?
0

#1

Can someone explain me this please:

url: is the API url.
datatype: json jsonp http the type of data I’m requesting?
type: post or get I’m not sure about this?
headers: don’t have the close idea ???
data: the data I’m sending, why I’m sending data??
success: the function after everything is ok?

function searchf(){
    $.ajax({
        url: api,
        dataType: 'jsonp',
        type: 'POST',
        headers: {
            
        }
    })
}

Thank you!


#2

According to the documentation, the headers object is just a plain object. The header you want to set will be a property in the object. The value is whatever you want to set the value of the header to. For example,

function searchf(){
    $.ajax({
        url: api,
        type: 'GET',
        headers: {
            'Accepts': 'application/json',
            'Authorization': 'catcatcatcatcatcatcatcat'
        }
    })
}