jQuery load() Method
💙The load() method loads data from a server and puts the returned data into the selected element.Syntax:
$(selector).load(URL,data,callback);
💖The required URL parameter specifies the URL you wish to load.<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("demo_test.txt #p1");
});
});
</script>
jQuery $.get() Method
💙The $.get() method requests data from the server with an HTTP GET request.Syntax:
$.get(URL,callback);
<script>
$(document).ready(function(){
$("button").click(function(){
$.get("demo_test.asp", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
</script>
jQuery $.post() Method
💙The $.post() method requests data from the server using an HTTP POST request.Syntax:
$.post(URL,data,callback);
<script>
$(document).ready(function(){
$("button").click(function(){
$.post("demo_test_post.asp",
{
name: "Donald Duck",
city: "Duckburg"
},
function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
</script>
No comments:
Post a Comment