为什么jquery ajax返回的结果已损坏?

时间:2019-05-19 06:39:38

标签: php jquery ajax

我正在为与测验相关的网站创建一个管理面板。问题是jquery调用工作正常并且在localhost上显示正确的结果,但是当我将其移至服务器时,其显示的结果不正确

我尝试将文件重新上传到服务器,但似乎无法正常工作。我使用的是namecheap恒星加上托管功能

$('#gen_test').on('click', function() {
  var test_name = $('#test_name').val();
  var maincategory = $('#maincategory').val();
  var categorySubject = $('#categorySubject').val();
  var subjectdivision = $('#subjectdivision').val();
  var subjectsubdivision = $('#subjectsubdivision').val();
  var subjectchilddivision = $('#subjectchilddivision').val();

  var information = 'test_name=' + test_name + '&maincategory=' + maincategory + '&categorySubject=' + categorySubject + '&subjectdivision=' + subjectdivision + '&subjectsubdivision=' + subjectsubdivision + '&subjectchilddivision=' + subjectchilddivision;

  $.ajax({
    type: 'POST',
    url: 'fetch/addtest.php',
    data: information,
    success: function(html) {
      $('#addResult').html(html);
    }
  });

});

预期结果: 预期:<div class='alert alert-danger alert-dismissable'> <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button> <h4><i class='icon fa fa-ban'></i> Alert!</h4> Category not found </div>

实际:<option value=" ">Select category Subject</option><div class='alert alert-danger alert-dismissable'> <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button> <h4><i class='icon fa fa-ban'></i> Alert!</h4> category Not found; </div>

0 个答案:

没有答案