Skip to Content

Ajax requests


Breeze provides a wrapper around fetch function to make requests in jQuery-like API.

View Source Code

Sending request

$.ajax(url|options, data|successFn);
$.get(url|options, data|successFn);
$.post(url|options, data|successFn);


Here is a list of available options:

    url: 'url',
    method: 'get|post|put|delete|head',
    headers: {
        'X-Requested-With': 'XMLHttpRequest'
    data: Object|$('#myform'),
    success: (data, response) => {},
    complete: (response) => {},
    error: (response, error) => {},

You can pass other options that are the part of fetch API.

Aborting request

Ajax function returns a Promise with custom abort method. Use it to abort unfinished request:

var promise = $.get({
    url: 'url',
    error: function (response, error) {
        // response is undefined when request is aborted