text: $('body').on('click', '.pagination a', function (e) {
      e.preventDefault();
      $('#load a').css('color', '#dfecf6');
      $('#load').append('<img style="position: absolute; left: 0; top: 0; articles/listingz-index: 100000;" src="/images/loading.gif" />');
      var url = $(this).attr('href');
      var page_number = get_parameter_val("page", url);
      var url = window.location.href;
      var url = updateQueryStringParameter(url, "page", page_number);
      var data = make_final_parameters_object(url);
      data = makeDataObject(data);
      getRecords(url, data);
      window.history.pushState("", "", url);
  });
  
  $("#applyfilterbtn").on("click", function (e) {
      e.preventDefault();
      $('#load a').css('color', '#dfecf6');
      $('#load').append('<img style="position: absolute; left: 0; top: 0; articles/listingz-index: 100000;" src="/images/loading.gif" />');
      var url = $(location).attr('href');
      var page_number = get_parameter_val("page", url);
      var url = window.location.href;
      var url = updateQueryStringParameter(url, "page", 1);
      var data = make_final_parameters_object(url);
      data = makeDataObject(data);
      getRecords(url, data);
      window.history.pushState("", "", url);
  });
  
  $("#SerachFilterBtn").on("click", function (e) {
  
      e.preventDefault();
      $('#load a').css('color', '#dfecf6');
      $('#load').append('<img style="position: absolute; left: 0; top: 0; articles/listingz-index: 100000;" src="/images/loading.gif" />');
      var url = $(location).attr('href');
      var page_number = get_parameter_val("page", url);
      var url = window.location.href;
      var url = updateQueryStringParameter(url, "page", 1);
      var data = make_final_parameters_object(url);
      data = makeDataObject(data);
      getRecords(url, data);
      window.history.pushState("", "", url);
  
  });
  
  function ResetOptions() {
  
      $("#filterBtn").prop("disabled", true);
      $('#load a').css('color', '#dfecf6');
      $('#load').append('<img style="position: absolute; left: 0; top: 0; articles/listingz-index: 100000;" src="/images/loading.gif" />');
      var url = $(location).attr('href');
      var page_number = get_parameter_val("page", url);
  
      $("#search_customer_field_filter").val('');
      $("#search_order_id_field_filter").val('');
      $("#filter_status").val('').change();
      $("#from_date").val('');
      $("#to_date").val('');
  
  
      var url = window.location.href;
      var url = updateQueryStringParameter(url, "page", 1);
      var data = make_final_parameters_object(url);
      data = makeDataObject(data);
      getRecords(url, data);
      window.history.pushState("", "", url);
  }
  function applyfillter() {
  
      $('#load a').css('color', '#dfecf6');
      $('#load').append('<img style="position: absolute; left: 0; top: 0; articles/listingz-index: 100000;" src="/images/loading.gif" />');
      var url = $(location).attr('href');
      var page_number = get_parameter_val("page", url);
      var url = window.location.href;
      var url = updateQueryStringParameter(url, "page", 1);
      var data = make_final_parameters_object(url);
      data = makeDataObject(data);
      getRecords(url, data);
      window.history.pushState("", "", url);
  }
  
  function getRecords(url, data) {
      block_gui_start();
      $.ajax({
          data: data,
          url: url,
          dataType: 'json',
          success: function (data) {
              block_gui_end();
              $('#categories_listing').html(data.content);
              $("html, body").animate({scrollTop: 0}, 500);
          }, error: function (data) {
              block_gui_end();
              console.log("Categories could not be loaded.");
          }
      })
  }
  
  function get_parameter_val(name, url) {
  
      url = filter_uri(url);
      var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(url);
      if (results == null) {
          return null;
      } else {
          return results[1] || 0;
      }
  }
  function updateQueryStringParameter(uri, key, value) {
  
      uri = filter_uri(uri);
      var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
      var separator = uri.indexOf('?') !== -1 ? "&" : "?";
      if (uri.match(re)) {
          return uri.replace(re, '$1' + key + "=" + value + '$2');
      } else {
          return uri + separator + key + "=" + value;
      }
  }
  
  function make_final_parameters_object(sourceURL) {
  
      var queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
      var obj = {};
      var pairs = queryString.split('&');
      for (i in pairs) {
          var split = pairs[i].split('=');
          if (obj[decodeURIComponent(split[0])]) {
              obj[decodeURIComponent(split[0])] = obj[decodeURIComponent(split[0])] + "," + decodeURIComponent(split[1]);
          } else {
              obj[decodeURIComponent(split[0])] = decodeURIComponent(split[1]);
          }
      }
      return obj;
  }
  
  function filter_uri(uri_enc) {
      if (typeof uri_enc !== "undefined")
          uri_enc = uri_enc.replace(/\+/g, '%20');
      return decodeURIComponent(uri_enc);
  }
  
  function makeDataObject(data) {
  
      if ($("#search_customer_field_filter").val())
          data['search'] = $("#search_customer_field_filter").val();
      else
          data['search'] = "";
  
      if ($("#search_order_id_field_filter").val())
          data['order_id'] = $("#search_order_id_field_filter").val();
      else
          data['order_id'] = "";
  
  
      if ($("#filter_status").val())
          data['status'] = $("#filter_status").val();
      else
          data['status'] = "";
  
      if ($("#sort_order").val())
          data['sort_order'] = $("#sort_order").val();
      else
          data['sort_order'] = "";
  
      if ($("#sort_by").val())
          data['sort_by'] = $("#sort_by").val();
      else
          data['sort_by'] = "";
  
      if ($("#from_date").val())
          data['from_date'] = $("#from_date").val();
      else
          data['from_date'] = "";
  
      if ($("#to_date").val())
          data['to_date'] = $("#to_date").val();
      else
          data['to_date'] = "";
  
      return data;
  
  }
  
  function toggleFilterBtn() {
  
      var f1 = $("#search_field_filter").val();
      var f2 = $("#filter_status").val();
      if (f1 || f2) {
          $('#filterBtn').prop('disabled', false);
      } else {
          $("#filterBtn").prop("disabled", true);
      }
  }
  
  
  
  
  //button-save
  