Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 18:08:37
Original
1028 people have browsed it

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
    }
    });
    Related labels:
    source:php.cn
    Statement of this Website
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!