Recent

Custom Controls Using Angular Material

Git Repo:  https://github.com/yawahang/ohcontrols Features DatePicker (Date Picker, Time Picker, Date Time Picker, and many more) RatingPicker (Vertical, Horizontal, Custom Icons) Select (Single Select, MultiSelect, Single Column, MultiColumn) Recursive Treeview

Ajax Request with Callback function

// Implementation
makeAjaxCall("/Controller/Action""GET", { arg1:"value1"arg2:"value2"}, "Error loading data !""error"function(response) {
  ds = response;
});

function makeAjaxCall(urlmethodTypejsonDataerrorTexterrorTypecallback) {
  $.ajax({
    url: url,
    method: methodType,
    dataType: "json",
    contentType: 'application/json; charset=utf-8',
    data: jsonData,
    async: false,
    success: function (result) {

      result = result === null ? [] : result;
      var p = false;
      try {

        JSON.parse(result); // try parse json if success .. parse & send data .. else send as it is
        p = true;
      }
      catch (e) { }

      p === true ? result = JSON.parse(result) : result = result;
      return callback(result);
    },
    error: function (result) {

      window.alert(errorTexterrorType5000);
      return;
    }
  });
}

Comments

Top Posts

SQL Server Symmetric Key & Certificate based Encryption With AES_256 Algorithm

Kendo Grid Angular Column Width, minResizableWidth dynamic

Kendo Grid AutoFit Columns