问题描述:

I have an iframe that has a form. When I press the "send" button, a jquery function handles the "click" event and send the form via ajax. The return of the ajax is then written on a div in the document. Simple, isn't? This works on all browsers, except IE8. In IE8, when the ajax "done" function writes the answer of the request in the div, the form become completely messed, as it has no style classes.

Here is the code:

<form class="ux-form" id="mailForm" name="mailForm">

<label for="subject">Assunto</label>

<input type="text" id="subject" name="subject" value="" />

<label for="nome">Seu nome</label>

<input type="text" name="nome" id="nome" value="" />

<label for="email">Seu e-mail</label>

<input type="text" name="email" id="email" value="" />

<label for="comentarios">Mensagem</label>

<textarea name="comentarios" id="comentarios" rows="6"></textarea>

<input class="btn btn-prime" type="button" value=" Enviar " />

<input class="btn btn-prime" type="reset" value=" Limpar " />

</form>

<div id="reply"></div>

<script type="text/javascript">

$(function(){

$('#mailForm').find('input[type="button"]').off('click').on('click', function(e){

e.preventDefault();

$('#reply').empty();

$.ajax({

url:'faleconosco.reply.php',

type:'POST',

cache:false,

dataType:'html',

data:$('#mailForm').serialize()

})

.done(function(result){

$('#reply').html(result);

})

});

});

</script>

Thanks for any help.

相关阅读:
Top