Home  >  Article  >  Web Front-end  >  jquery reads page load get post ajax four ways to write code_jquery

jquery reads page load get post ajax four ways to write code_jquery

WBOY
WBOYOriginal
2016-05-16 18:08:371014browse

load

Copy code The code is as follows:

$("#result").load(" aaaa.asp #ccc");

get
Copy code The code is as follows:

$.get("aaaa.asp", { action:"get",name:"lulu" },
function(data, textStatus){
$("#result") .html(data);
//alert(this);
//alert(data);
//alert(textStatus);
});

post
Copy code The code is as follows:

$.post("aaaa.asp", { action:"post",name:"lulu" },
function(data, textStatus){
$("#result").html(data);
});

ajax
Copy code The code is as follows:

$.ajax({
type: "get",
url: "http://www.jb51.net/rss",
beforeSend: function(XMLHttpRequest){
//$('
Data loading, please wait
')
//.insertAfter($("#btn_ajax"))
//.fadeIn('slow')
//.animate({opacity: 1.0}, 3000)
//.fadeOut('slow', function() {
//$(this).remove();
// });
},
success: function(data, textStatus){
$("#result").html("");
$("item",data).each (function(i, domEle){
$("#result").append("
  • " $(domEle).children("title").text() "
  • ") ;
    });
    },
    complete: function(XMLHttpRequest, textStatus){
    //alert("Loading completed! ");
    },
    error: function(){
    //Request error handling
    }
    });
    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn