Computer Magic Logo
Ajax template

Friday, January 22, 2016

Published by Aristotelis Pitaridis

The ajax method allows us to submit data to the server and get back information from the server.

$.ajax({
    type: "POST",
    url: '/Service/GetValues',
    data: { 'Value1': 12, Value2 : 'Test Message' },
    datatype: 'json',
    cache: false,
})
.success(function (data) {
    // on success use return data here
})
.error(function (xhr, ajaxOptions, thrownError) {
    // The ajax call failed
});