|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jan 2005
Città: Roma
Messaggi: 4870
|
[mootools] Aggiungere un'evento ad un form caricato tramite ajax
Il titolo non è proprio chiarissimo e quindi ora cerco di spiegarlo meglio.
Devo inviare un form html a php con Form.send() di mootools, l'esempio demo dice questo: codice html Codice:
<form id="myForm" action="/demos/Form.Send/ajax.form.php" method="post"> <div id="form_box"> <div> <p>First Name:</p> <input type="text" name="first_name" value="John" /> </div> <div> <p>Last Name:</p> <input type="text" name="last_name" value="Q" /> </div> <div> <p>E-Mail:</p> <input type="text" name="e_mail" value="john.q@mootools.net" /> </div> <div> <p>MooTooler:</p> <input type="checkbox" name="mootooler" value="yes" checked="checked" /> </div> <div> <p>New to Mootools:</p> <select name="new"> <option value="yes" selected="selected">yes</option> <option value="no">no</option> </select> </div> <input type="submit" name="button" id="submitter" /> <span class="clr"><!-- spanner --></span> </div> </form> <div id="log"> <h3>Ajax Response</h3> <div id="log_res"><!-- spanner --></div> </div> Codice:
window.addEvent('domready', function() { $('myForm').addEvent('submit', function(e) { e.stop(); var log = $('log_res').empty().addClass('ajax-loading'); this.set('send', {onComplete: function(response) { log.removeClass('ajax-loading'); log.set('html', response); }}); this.send(); }); }); Codice:
$('esempio').load('form.html'); Come posso risolvere? come posso assegnare l'evento al form che carico successivamente? Grazie H2K |
![]() |
![]() |
![]() |
#2 |
Messaggi: n/a
|
Guarda con Mootools non saprei ma con JQuery puoi usare Livequery.
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Jan 2005
Città: Roma
Messaggi: 4870
|
|
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 10:47.