Last active
November 15, 2018 12:18
-
-
Save purushottam10/721430322654572db518f06941596b13 to your computer and use it in GitHub Desktop.
i want to update data on view page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(document).ready(function () { | |
$('#edit').click(function () { | |
var id=$('id').val()/*$(this).attr('#id')*/; | |
var studentName=$('studentName').val()/*$(this).attr('#studentName')*/ ; | |
var age=$('age').val()/*$(this).attr('#age')*/ ; | |
$.post("EditStudent",{ | |
id:id, | |
studentName:studentName, | |
age:age | |
}, | |
function(){ | |
alert("Data:reached "); | |
}); | |
/* $.ajax({ | |
type:'POST', | |
data:{ | |
id:id/!*$(this).attr('#id')*!/, /* these are sending null value to servlet */ | |
studentName:studentName/!*$(this).attr('#studentName')*!/, | |
age:age/!*$(this).attr('#age')*!/ | |
}, | |
url:'EditStudent' | |
});*/ | |
}); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<c:forEach items="${studentList}" var="student"> | |
<tr> | |
<td id="id" ><c:out value="${student.roll_no}"/></td> | |
<td contenteditable="true" id="studentName" ><c:out value="${student.studentName}"/></td> | |
<td contenteditable="true" id="age"><c:out value="${student.age}"/></td> | |
<td><a href="<c:url value="/DeleteStudent?id="/><c:out value="${student.roll_no}"/>"> Delete</a></td> | |
<%-- <td> <a href="<c:url value="/EditStudent?id="/><c:out value="${student.roll_no}"/>">Edit</a></td> | |
--%> <td><input type="button" id="edit" value="edit"> | |
</td> | |
</tr> | |
</c:forEach> | |
<%-- how to send data using these id of attributes --%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment