简体   繁体   中英

Send multi message using jquery plugin in multi-row data?

i use jquery.form to send a form, but in may case below how use this jquery plugin

$('#htmlForm').ajaxForm({ 
    target: '#htmlExampleTarget', 
    success: function() { 
        $('#htmlExampleTarget').fadeIn('slow');
        $('#htmlForm').hide();
    } 
});

for($i=1;$i<= 10;$i++){

//form $1

form name="form$i" action="blabla.php"

input type="text" name="name$i" />

input type="text" name="name$i" />

input type="submit" name="submit" /

}

Use class instead of id and loop through the forms. For the target take an id like #htmlExampleTarget1.

var i = 1;
$('.htmlForm').each(function () {
   var object = $(this);
   object.ajaxForm({
      target: '#htmlExampleTarget' + i, 
      success: function() { 
         $('#htmlExampleTarget' + i).fadeIn('slow');
         object.hide();
       }
   });
   i++;
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM