i'm fetching all the values of same field name using jquery
$('input[name^="StudentName"]').each(function() {
StudentName+= $(this).val();
alert(StudentName);
});
while alert i'm getting all values as one string such as "Student1Student2Student3" and so on. how can I separate each name of student ?
$.ajax({url:"<?=base_url(); ?>StudentAttendance/SaveAttendance",
data: "StudentName="+StudentName,
success:function(result){
$("#result").html(result);
}});
and when i'm sending it through jquery i'm getting only the last field name value as Student4. kindly help me out.
Note: text fields are dynamic
StudentNamethen I would expect that entire value to be sent to the server as a string just like any other value. While it's clear that perhaps something other than string concatenation would likely be ideal here, what's not clear is what the actual problem is.