weixin_33736048 2018-11-14 13:11 采纳率: 0%
浏览 25

div上的ajax调用问题

I have multiple div with class "btn-custom btn-custom-primary". The AJAX call is not loading on .btn-custom click event but when I check on network section in console tab the data is returned through ajax success: function (data) but when i debug the code it throws "data is not defined" reference error and there is no error in console. Please help.

$(document).on('click', '.btn-custom', function() {
  var id = $(this).attr('id');
  var bid = $(this).attr('bid');
  $('.btn-custom').removeClass('btn-custom-selected').addClass("btn-custom-primary");
  $(this).removeClass("btn-custom-primary").addClass('btn-custom-selected');
  var HostelId = getParameterByName("id", window.location.href);

  $.ajax({
    url: 'index.php?secController=School&action=fetchActiveStatusOfRoom',
    type: 'POST',
    dataType: 'JSON',
    async: false,
    data: {
      id: HostelId,
      RoomId: id
    },
    success: function(data) {

    }
  });
});
  • 写回答

0条回答 默认 最新

    报告相同问题?