2014-09-11 2 views
0

IE11에서 JQuery로 Ajax 게시를하려고합니다. ie-9에 대한 호환성 메타 태그를 수정했지만 여전히 작동하지 않으며 게시물을 보내지 않습니다. 대신 jquery에서 {exception} Unable to get property 'settings' of undefined or null reference이라고 말하는 오류가 발생합니다.IE 11에서 AJAX를 통해 양식 게시

머리

<head id="Head1"> 
<link href="../Content/Site.css" rel="stylesheet" type="text/css" /> 
<link href="../Content/datepicker.css" rel="stylesheet" type="text/css" /> 
<script src="/.../Scripts/jquery-1.8.2.min.js" type="text/javascript"></script> 
<script src="/.../Scripts/jquery-ui-1.10.4.custom.min.js" type="text/javascript"></script> 
<script src="/.../Scripts/json2.js" type="text/javascript"></script> 
<script src="/.../Scripts/jquery.validate.min.js" type="text/javascript"></script> 
<script src="/.../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script> 
<script src="/.../Scripts/UtilityFunctions.js" type="text/javascript"></script> 
<script src="/.../Scripts/jquery-ui-1.11.0/jquery-ui.js"></script> 
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1;IE=9;IE=8;IE=7" /> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<link rel="shortcut icon" href="../Content/images/favicon.ico" /> 
<meta http-equiv="Pragma" content="no-cache" /> 
<meta http-equiv="Expires" content="-1" /></head> 

JQuery와

$('#EmailForm').validate({ 
      invalidHandler: function(event, validator) { 
       var errors = validator.numberOfInvalids(); 
       if (errors) { 
        var message = errors == 1 
         ? '1 email field has a missing or invalid email address. It has been highlighted, please correct this or remove the field.' 
         : errors + ' email fields have missing or invalid email addresses. It has been highlighted, please correct this or remove the fields.'; 
        $("div.error span").html(message); 
        $("div.error").show(); 
       } else { 
        $("div.error").hide(); 
       } 
      }, 
      submitHandler: function (form) { 
       $(form).ajaxSubmit(function() { 
        history.go(-1); 
       }); 
      } 
     }); 

     $('body').on('click', '.remove_field', function() { 
      $(this).closest('p').remove(); 
     }); 
     $('.add_email_button').closest('p').click(function() { 
      var html = '<p><input type="email" class="email" form="EmailForm" required name="EmailAddresses" /><span class="btn_orange"><a href="#" class="remove_field">x</a></span></p>'; 
      $(html).insertBefore($(this)); 
     }); 
     $('#SendEmail_Button').closest('span').click(function (e) { 
      e.preventDefault(); 
      $('#EmailForm').submit(); 
      @* if ($('#EmailForm').valid()) { 
       $.post('@Url.Action("PostEmail")', $('#EmailForm').serialize()).done(function() { 
        history.go(-1); 
       }); 
      }*@ 
     }); 

의 web.config

당신이해야 할
<httpProtocol> 
    <customHeaders> 
    <clear/> 
    <add name="X-UA-Compatible" value="IE=IE9"/> 
    </customHeaders> 
</httpProtocol> 

답변

1

$("#EmailForm").validate({ 
    // options 
}); 

전에 $("#EmailForm").valid()을 사용할 수 있습니다. AJAX를 완료 한 후 역사 운동에 대한

는 그것을 할 :

submitHandler: function(form) { 
    $(form).ajaxSubmit(function() { 
     history.go(-1); 
    }); 
} 
+0

나는 당신의 제안에보다 내 질문을 업데이트했습니다하지만 여전히 작동하지 않습니다. 이것은 심지어 크롬에서 그것을 깨뜨린다. 크롬에서 그것은 역사에서 돌아갈 것이지만 POST가 작동하지 않습니다 –

+0

역사에 돌아가서 페이지가 다시로드됩니다. 그렇게하면 모든 스크립트가 중지됩니다. – Barmar

+0

그게 내가 마지막으로 넣은 이유 –

관련 문제