javascript - Jquery serialize does not send input fields -
i have form input fields triggered every 1 min update user entries server.
$(document).ready(function() { timer = setinterval(function() { save(); }, 60000); }); function save() { jquery('form').each(function() { jquery.ajax({ url: "http://localhost:7002/submitstudent.do?requesttype=auto&autosave=true", data: $('#form').serialize(), type: 'post', success: function(data){ if(data && data == 'success') { alert("data saved"); }else{ } } }); }); }
and here form
<form name="listbean"> <c:foreach var="item" items="${listbean.namelist}" varstatus="status"> <input type="number"name="namelist<c:outvalue='[${status.index}]'/>.initialweight" onchange="checkonchange(this,'<c:out value='${item.personid}'/>','<c:out value='${item.minweight}'/>','<c:out value='${item.maxweight}'/>','<c:out value='[${status.index}]'/>')"> <br><br> <input type="number" name="namelist<c:out value='[${status.index}]'/>.finalweight" onchange="checkonchange(this,'<c:out value='${item.personid}'/>','<c:out value='${item.minweight}'/>','<c:out value='${item.maxweight}'/>','<c:out value='[${status.index}]'/>')"> <br><br> <input type="text" class="formtext" name="namelist<c:out value='[${status.index}]'/>.reason" id ="reason<c:out value='[${status.index}]'/>" value="" maxlength="255" > <br><br> <input type="submit" value="submit" id="submit" /> </c:foreach> </form>
so ajax calls server works fine every 1 min .but values entered not available @ server side.
i getting value listbean.item.getinitialweight().
what doing wrong ?
any suggestions welcome.thanks time ..
data: $('#form').serialize(),
should become
data: $('form').serialize(),
you referencing wrong dom item
Comments
Post a Comment