2013-11-21 4 views
0

Я использую плагин JQuery Form. В IE9 иногда я получаю сообщение об ошибке «SCRIPT5: Access Denied» на консоли. Он работает с Mozilla и Chrome. вот мой код:JQuery form plug in issue on IE9

Форма: ее скрытая форма на моем представлении, и я представляю эту форму на onchange событие управления входным типом файла.

<form id="fileAttachment" action="@Url.Action("AttachFile", "Attachment")" method="post" enctype="multipart/form-data"> 
    <input type="file" id="upload" name="upload" onChange="submitFormOnFileSelection()"/> 
    <input type="submit" id="xxx" name="asd" /> 
</form> 

Код представить форму:

$(document).ready(function() { 
     var options = { 
      beforeSend: function() { 

      }, 
      uploadProgress: function (event, position, total, percentComplete) { 

      }, 
      success: function() { 

      }, 
      complete: function(response) { 
       $("#AttachmentArea").html(response.responseText); 
      }, 
      error: function() { 
       $("#AttachmentArea").html("<font color='red'> ERROR: unable to upload files</font>"); 
      } 

     }; 
     $("#fileAttachment").ajaxForm(options); 

    }); 

function submitFormOnFileSelection() { 

     if ($("#upload").val() != '') { 
      $('#fileAttachment').submit(function() { 
       $("#fileAttachment").ajaxSubmit(options); 
      }); 
      $("#upload").val(''); 
     } 
    } 

Проблема возникает на IE9 ??

благодарит за помощь.

+0

Какая часть javascript делает «SCRIPT5: Access Denied» указывает на? –

+0

@ karthik проблема есть с формой.подчинить в jqueryform.js .. –

ответ

0

Вы не можете сделать это $ ("# upload"). Val ('') с входными файлами в ie. Правильный способ его очистки - заменить новый.

$("#upload").replaceWith('<input type="file" id="upload" name="upload" onChange="submitFormOnFileSelection()"/>'); 
+0

спасибо, сделаю это. но на самом деле проблема с formubmit .. он не отправляет форму серверу на IE9. но отлично работает с другими браузерами. –