我在表單上有Img標籤,我想將此ID發送至aspx.cs
。我使用post方法,並使用Request.Form["id"]
回顧此ID,但我沒有得到aspx.cs
文件的ID。如何將點擊html標籤的值(id)發送到asp.net?
代碼:
$("img").click(function() {
var id = $(this).attr("id");// Here I am getting id How can i send this id to aspx.cs
jq.post("WebForm1.aspx",
id: $(this).attr("id"));
});
不要過度使用jQuery。 'this.id'會給你帶來'id',它比'$(this).attr('id')'更快更快' – gdoron