//Code Behiend
//Add Library
using System.Web.UI.HtmlControls;
[WebMethod]
public static string PostMethod(string parameter)
{
//you can return your string value
return parameter;
}
//Design Page
//Add javascript Library
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
//Add This Script
<script type="text/javascript">
$.ajax({
type: "POST",
url: "pagename.aspx/PostMethod",
data: "{parameter:'123'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
alert(r.d);
}
});
</script>
No comments:
Post a Comment