Prev Demo
jQuery
>
.Post() & .Get() - Get & Post Request To Server
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body> <h1>This is for Post Method</h1> <input type="button" id="btnPost" value="Load Data using Post" /> <div id="divResult"></div> <script> $("#btnPost").click(function () { $.post( "jQueryAjaxData.aspx", { a: "20", b: "6" }, function (data) { $("#divResult").html("<b>The result is: " + data + "</b>"); }); }); </script> <br/> <br/> <br/> <h1>This is for Get method</h1> <input type="button" id="btnGet" value="Load Data using Get" /> <div id="divResult"></div> <script> $("#btnGet").click(function () { $.get( "jQueryAjaxData.aspx", { ag: "2", bg: "6" }, function (data) { $("#divResult").html("<b>The result is: " + data + "</b>"); }); }); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output