<input type="hidden" id="cid" value="<%=cid %>"> <input type="hidden" id="email" value="<%=user%> "> <input type="hidden" id="gid" value="<%=grid %>"> <input type="hidden" id="postid" value="<%=postid %>"> <input type="text" value="<%=msg%>" name="comment" id="comment"> <input type="submit" value="submit" id="<%=cid %>" class="sub"/>
$(.sub ).click(function(e) { e.preventDefault(); var cid=$("#cid").val(); var comment = $("#comment").val(); var email=$("#email").val(); var gid=$("#gid").val(); var postid=$("#postid").val(); var value ='comment='+comment+'&cid='+cid+'&email='+email+'&gid='+gid+'&postid='+postid; $.ajax({ url: "update.jsp", //type: "post", data: value, cache: false, success: function(data) { $("#comment_display").html(data).slideDown('fast'); } }); }); }
ID
submit
sub
$('.sub').click(function (e) { e.preventDefault(); var cid = this.id; // get the button id here alert(cid); // you can also check it using alert // Your code goes here... });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)