how can send multiple data dynamically generated fields in ajax?
since can't know number of fields in advance used loop doesn't work me.
$.ajax({ type: 'get', data:{ expectationpercentagepairid: json.stringify(expectationpercentagepairids), expectationscores: expectationscores, for(var id in expectationpercentagepairids){ score-${id}: $("input[name='score-'+id]") } }, url:'${g.createlink( controller:'review', action:'savereview', params:[id: params.id] )}' });
a loop wont work here. pass form data using serialize , handle data on backend.
$.ajax({ type: 'get', data:{ $('form').serialize() }, url:'${g.createlink( controller:'review', action:'savereview', params:[id: params.id] )}' });
Comments
Post a Comment