How to pass an asp.net control to a jQuery ajax call?
Posted
by Abe Miessler
on Stack Overflow
See other posts from Stack Overflow
or by Abe Miessler
Published on 2010-05-05T04:49:19Z
Indexed on
2010/05/05
4:58 UTC
Read the original article
Hit count: 215
I have the following jQuery event that gets fired every time an anchor is clicked. How can I pass a asp.net control (lets say a textbox called "tb_name") as one of the parameters, in addition to the "target" parameter i'm already passing?
<script type="text/javascript">
$(document).ready(function() {
$("a").click(function(event) {
$.ajax({
type: "POST",
url: "Default.aspx/Click",
data: "{target:'" + event.target + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function(xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
$("#myContent").html(xhr.statusText);
//alert(xhr.responseText);
},
success: function(msg) {
alert(msg.d);
}
});
return false;
})
})
</script>
© Stack Overflow or respective owner