Commit c46e6e98 authored by tom's avatar tom

Return jqxhr object from ajax request

Not the context of the request
parent e83d6b94
......@@ -78,27 +78,24 @@
}
delete args.data;
$.extend(args, {statusCode: statusCode});
return this.each(function () {
var ajaxOptions = {
type: type,
url: $(this).slapos('host') + method,
contentType: 'application/json',
//cache: false,
data: JSON.stringify(data),
datatype: 'json',
context: $(this),
headers: {
'Accept': 'application/json',
},
beforeSend: function (xhr) {
if ($(this).slapos('access_token')) {
xhr.setRequestHeader('Authorization', $(this).slapos('store', 'token_type') + ' ' + $(this).slapos('access_token'));
}
}
};
$.extend(ajaxOptions, args);
$.ajax(ajaxOptions);
});
var ajaxOptions = {
type: type,
url: $(this).slapos('host') + method,
contentType: 'application/json',
data: JSON.stringify(data),
datatype: 'json',
context: $(this),
headers: {
'Accept': 'application/json',
},
beforeSend: function (xhr) {
if ($(this).slapos('access_token')) {
xhr.setRequestHeader('Authorization', $(this).slapos('store', 'token_type') + ' ' + $(this).slapos('access_token'));
}
}
};
$.extend(ajaxOptions, args);
return $.ajax(ajaxOptions);
},
instanceList: function (args) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment