I need to add a number to the end of each javascript variable and JQuery element.
Here's my code:
$("#insert1").click(function(){
var collegeId1=$("#collegeId1").val();
$.post('insert.php', {collegeId: collegeId1});
return false;
});
$("#insert2").click(function(){
var collegeId2=$("#collegeId2").val();
$.post('insert.php', {collegeId: collegeId2});
return false;
});
... and so on. I need to continue adding numbers to the end of each element and variable (i.e. collegeId[number] and ("#insert[number]"). I've tried looping, .append, +, etc and nothing seems to be working.
Any help would be greatly appreciated!