0

I am creating a function of ajax that is reusable. However, I am experiencing trouble as follow. The data return is dependent on the web api and i want to make it render accordingly to parameter input.

// Ajax call
$.ajax({
    url: '',
    type: 'GET",
    data: { },
    success: function(data) {
      $.each(data.LanguageList, function(index,value) {
         // Perform action
      });
    }
});

// Make into function (fail)
function loadAjax(param1) {
  $.ajax({
    url: '',
    type: 'GET",
    data: { },
    success: function(data) {
      $.each(param1, function(index,value) {
         // Perform action
      });
    }
  })
}

loadAjax(data.LanguageList);
stacknist
  • 517
  • 1
  • 6
  • 12

0 Answers0