ajax数据请求

Posted yaomengli

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ajax数据请求相关的知识,希望对你有一定的参考价值。

load 用来请求公共部分;

比如copy里面的div 想要请求tpl里面的ul;

 //  load方法
$("div").load(‘tpl.html‘,function (data) {
console.log(data);
});

//post与get方法
$.post(‘tpl.html‘,function (data) {
console.log(data);
$("div").append(data)
});

$("div").load("tpl.mtml",function(data){

  data里面包含请求的数据

})

 

post 与get也是请求一个load都相似;

 










以上是关于ajax数据请求的主要内容,如果未能解决你的问题,请参考以下文章