jqueryajax的例子
程序员文章站
2022-06-28 21:21:46
首先引入jquery.js文件
首先引入jquery.js文件
<p class="row" id="row"> <p class="col-lg-3 col-md-3 col-sm-3 col-xs-3 ana_btn"> <img src="" alt="responsive image" class="img-responsive ana_btn_con img-rounded"> <a target="_blank" href="" style="color: #1b6d85; margin-top: 20px;font-size: 18px;margin-bottom: 20px"></a> <p style="color: #777"></p> </p> </p>
$(document).ready(function(){ var root = location.href.slice(0, location.href.lastindexof('/')); var path = root + '/appgallery/config/appsconfig.json'; //$("#imgid").attr('src',path); var childrens = $('body').find("#row")[0].children; //查找节点 $.ajax({ type:"get", url: path, data:{}, datatype: 'json', success:function(results){ var centents = results.typicalappcontents; for(var i=0;i