function api_get () {
$.ajax({
type: "GET",
url: <URL>,
crossDomain: true,
dataType: 'json',
data: bundle,
async: false,
timeout: 10000,
success: function (data) {
/* действия */
}
};
$('#updating').text("Updating");
beforeSend
Type: Function( jqXHR jqXHR, PlainObject settings )
A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request.
function api_get () {
$.ajax({
type: "GET",
url: <URL>
crossDomain: true,
dataType: 'json',
data: bundle,
async: false,
timeout: 10000,
beforeSend: function() {
$('#updating').text('loading');
},
success: function (data) {
$('#updating').empty();
/* действия */
}
};