can.ajax

  • function
 

Make an AJAX request.

can.ajax(settings)

Parameters

  1. settings {Object}

    Configuration options for the AJAX request. The list of configuration options is the same as for jQuery.ajax.

Returns

{can.Deferred}

A can.Deferred that resolves to the data.

can.ajax( settings ) is used to make an asynchronous HTTP (AJAX) request similar to http://api.jquery.com/jQuery.ajax/jQuery.ajax. The example below makes use of can.frag.

can.ajax({
    url: 'http://canjs.com/docs/can.ajax.html',
    success: function(document) {
        var frag = can.frag(document);
        return frag.querySelector(".heading h1").innerText; //-> can.ajax
    }
});