数据调取归整-2

ajax,jsonp调取信息方式:

$(function(){
  // $("#t310").prepend(classCourse(310))
})
/* 课程 */
// http://bj.xdf.cn/school/categoryClassjsonp?categoryCode=186&one=310&size=4&count=4
function classCourse(id_,id,dom,cout){
  $.ajax({
      type:'get',
      url:"http://bj.xdf.cn/school/categoryClassjsonp?categoryCode="+id_+"&one="+id+"&size="+cout,
      dataType:"jsonp",
      jsonp: "callback",
    // jsonpCallback:"soukecourse",
      success:function(data){
          // console.log(data)
          var classCode=data;
          var detail='';
          var now_date=new Date().Format("yyyy-MM-dd");;
          now_p_date=parseInt(now_date.replace(/-/g,''),10);
          for(var i=0;i'+classCode[i].startdate.substr(0,10)+''+classCode[i].classtimes+'次课'+''+classCode[i].price+'元免费了解课程'

          }
          if(detail!==''){
              // $('.kc-cont').find('tbody:first').prepend(detail);
              $("#"+dom).prepend(detail)
          }
          // console.log(detail)
          // return detail;
         

      },error:function(){
          alert("网络异常")
      }

  })
}
classCourse(186,310,'t310',4);
classCourse(186,325,'t325',6);
classCourse(186,326,'t326',5);
classCourse(186,327,'t327',5);
classCourse(186,328,'t328',5);
classCourse(186,318,'t318',4);
classCourse(186,315,'t315',4);
classCourse(186,316,'t316',4);

Date.prototype.Format = function (fmt) { //author: meizz   
  var o = {  
      "M+": this.getMonth() + 1, //月份   
      "d+": this.getDate(), //日   
      "H+": this.getHours(), //小时   
      "m+": this.getMinutes(), //分   
      "s+": this.getSeconds(), //秒   
      "q+": Math.floor((this.getMonth() + 3) / 3), //季度   
      "S": this.getMilliseconds() //毫秒   
  };  
  if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));  
  for (var k in o)  
  if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));  
  return fmt;  
}  

// 校区信息调取

function schoolAdress(){
    $.ajax({
        type:'get',
        url:'http://bj.xdf.cn/school/yasixuexi.html',
        dataType:'jsonp',
        jsonp:'callback',
        success:function(data){
            var address=data.schoolMap;
            // console.log(data)
            var deta1='';
    
            
            for(attr in address){
                for(var i=0;i

'+address[attr][i].school_address+'

'; } } // console.log(obj,obj2) if(deta1!==''){ $('.ul_lef').prepend(deta1) } } }) } schoolAdress();

使用轮播插件调取信息时注意,插件的加载顺序,否则插件的功能不可用,在success函数中调取成功之后再加载插件


  
  
  

你可能感兴趣的:(数据调取归整-2)