Reputation:
.aspx
-----------------------
<head>
<script type="text/javascript">
>> $(document).ready(function () {
$(".cssBtns").click(function () {
// call aspx.cs method generateInfo(this.id,this.className)
});
});
</script>
</head>
<body>
</body>
.aspx.cs
-----------------------
public void generateInfo(int btnId, string className){
print:// css button id:---
css button class:----
}
how can i call generateInfo method which is aspx.cs page by using java script/JQuery. and which is the best way.
Upvotes: 2
Views: 8267
Reputation: 27364
You can use $.ajax()
, $.post()
, $.get()
or $.getJSON()
for doing this.
$(".cssBtns").click(function () {
$.ajax({
url : 'aspx function path here'
});
});
See the link below for more reference.
how to call an ASP.NET c# method using javascript
http://api.jquery.com/jQuery.ajax/
Upvotes: 1