Online: 17313
To send asynchronous HTTP request to the server and get response (sending request to the server and getting response without browser postback/refresh), ajax method can be used.
<input type="button" id="bntAjax" value="Load Data + Other Ajax Test" />
<div id="divResult"></div>
<script>
$("#bntAjax").click(function () {
$.ajax({
type: "POST",
url: "jQueryAjaxData.aspx",
data: "a=2&b=5",
success: function (msg) {
$("#divResult").text(msg);
}
});
});
</script>
Here on click of “btnAjax” button, ajax method will fire.
Here
int a = int.Parse(Request.Form["a"]); int b = int.Parse(Request.Form["b"]);
The returned value from “jQueryAjaxData.aspx" page will be written to the “divResult”.