Skip to content

Response Handling

Fatih Koca edited this page Nov 27, 2019 · 3 revisions

The response returns the Object on the frontend.

Success and error together in then() method:

Vue.ajax({url: "http://example.com"})
    .then(function(response) {
        console.log(response.data);
    }, function(response) {
        console.log(response);
    })

Success and error together in separate methods:

Vue.ajax({url: "http://example.com"})
    .then(function(response) {
        console.log(response.data);
    })
    .catch(function(response) {
        console.log(response);
    })

The object in general is the following structure:

Vue.ajax.post("http://example.com", {pageNumber: 5})
    .then(function(response) {
        console.log(response.data)
    });
Clone this wiki locally