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

jquery uses ajax to call background method instance_jquery

WBOY
Release: 2016-05-16 17:24:38
Original
857 people have browsed it

Copy code The code is as follows:

Syntax:
$(function(){
var callback = function(r){ //r represents the data returned by the background data.
}
$.get("",callback); //Write the path of the method in quotation marks
}) ;

In this way, the data obtained by the background method can be displayed on the html front-end.


The following is a js and background method written at work:

js:

Copy code The code is as follows:

$(function(){
var callback = function (r) {
var data = "