form plugin + modalbox plugin
Bonjour,
J'utilise les plugins jquery form (http://jquery.malsup.com/form) et modalbox (http://code.google.com/p/jquery-modalbox-plugin/).
Indépendament ils fonctionnent bien mais je n'arrive pas à faire marcher ajax form dans une modal box. Les deux plugins sont-ils incompatibles? (je débute avec jquery, j'arrive à mes fins en suivant les tutos mais je ne connais pas encore bien le mécanisme interne derrière ajax...)
Voici le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <script>
jQuery(document).ready(function(){
jQuery("a.openmodalbox").modalBox();
var options = {
beforeSubmit: showRequest, // pre-submit callback
};
// bind to the form's submit event
$('#myForm2').submit(function() {
$(this).ajaxSubmit(options);
return false;
});
});
// pre-submit callback
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
alert('About to submit: \n\n' + queryString);
return true;
}</script> |
et le code html correspondant:
Code:
1 2 3 4 5 6
| <a class="openmodalbox" href="<?php echo $this->url(array(),'user-workplan-changetarget') ?>">
change your target
<span class="modalboxContent">
<?php echo $this->form ?>
</span>
</a> |
La modalbox fonctionne mais pas le jquery form.
Si je déplace le form en dehors de la modal box alors le jquery form fonctionne.