I wonder if it is possible to update the contents of a load. Example:
I have a form on the "submit_form.html"
<form action="submeter" method="post">
<input type="text" name="nome" value="" />
<input type="submit" value="Enviar" />
</form>
I load this form on another page ...
<div id="conteudoFixo">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel neque eu magna vestibulum tincidunt. Duis a lobortis felis, id pulvinar nulla. Pellentesque fermentum sollicitudin nisl, at molestie felis pretium vel. Donec tellus mauris, imperdiet sed sagittis in, consectetur quis ex.
</div>
<div id="conteudoMuda">
<button id="botaoForm">Mostrar Form</button>
</div>
And I use jquery to load:
jQuery('#botaoForm').click(function(){
jQuery('#conteudoMuda').load('/enviar_formulário.html');
});
The problem is that when I submit on form, it redirects me (action="submit") . I would like to send the data without being redirected.
Note: I can not use ajax to submit form.
Ajax code:
/* submeter form trocar nick */
jQuery('form[name="post"]').submit( function(){
event.preventDefault();
jQuery.ajax({
dataType:'html',
type : 'POST',
data : ({username_edit: jQuery("#username_edit").val(), user_rank : jQuery("#rankusren").val(), signature : jQuery("#assinaturaa").val(), profile_field_10_5 : jQuery("#profile_field_10_5").val(), user_status : jQuery("#user_status_yes").val(), user_allowpm : jQuery("#user_allowpm_yes").val(), user_allowavatar : jQuery("#user_allowavatar_yes").val(), mode : jQuery("[name='mode']").val(), agreed : jQuery("[name='agreed']").val(), id : jQuery("#idusrpnl").val()}),
success : function( resultado ){
alert('Nome trocado!');
}
});
});
/* fim do form trocar nick */