Ajax

post #

Arguments
options Object

This method allows to send POST ajax request to the backend.

$K.ajax.post({
    url: '/request/',
    data: 'a=b&c=d', // or key=value object
    before: function(xhr) {},
    success: function(response) {},
    error: function(response) {}
});

By default, all requests are sent asynchronously. If you need synchronous requests, set the option async to false.

If the return value for response in success/error callback is a JSON string, it will be automatically converted to an object.

get #

Arguments
options Object

This method allows to send POST ajax request to the backend.

$K.ajax.get({
    url: '/request/',
    data: 'a=b&c=d', // or key=value object
    before: function(xhr) {},
    success: function(response) {},
    error: function(response) {}
});

By default, all requests are sent asynchronously. If you need synchronous requests, set the option async to false.

If the return value for response in success/error callback is a JSON string, it will be automatically converted to an object.