jsonp AND ajax

$(document).ready(function() {

   var now_date = new Date();
   var now_date_today = new Date("yy,mm,dd");  
   var now_time_obj =  document.getElementById("now_time");
   now_time_obj.textContent = now_date_today;
   var date_now = document.getElementsByClassName("op_weather4_twoicon_date")
   date_now.item(0).innerHTML = now_date;

   var total_left_div_class = document.getElementsByClassName("op_weather4_twoicon_temp");

    $.ajax({
      url: "http://10.255.32.250/total_left",
      data: ‘‘,
      dataType: ‘jsonp‘,
      // jsonpCallback:‘callback‘,
      //jsonpCallback:‘‘,
      success: function(result) {
          var total_left = result[0]["total_left"];
          var total_obj = total_left_div_class.item(0);
          console.log("hello");
          total_obj.innerHTML = total_left; 
      }
    });



    $.ajax({
      url: "http://10.255.32.250/recent_done_seven_days",
      data: ‘‘,
      dataType: ‘jsonp‘,
      //jsonpCallback:‘callback‘,
      //jsonpCallback:‘‘,
      success: function(result_get) {

          var url_range = result_get.url_range;
          url_range.sort()
          var result = result_get.result;
          var div_class_date_obj = document.getElementsByClassName("op_weather4_twoicon_date");
          var div_class_date_href = document.getElementsByClassName("op_weather4_twoicon_day OP_LOG_LINK");
          var count = 0;
          var day_arr = new Array;
          for ( var i in result) {
               day_arr.push(i)
          }
          day_arr.sort();

          for (var i in day_arr){
             var i  = day_arr[i] 
             count +=1; 
             var date_obj = div_class_date_obj.item(count);
                 date_obj.innerHTML = i;
             var total_src_obj = total_left_div_class.item(count);
               total_src_obj.innerHTML = "来源 <br>" + result[i];
             var day_href_obj = div_class_date_href.item(count-1);
                 var url_links = "http://10.255.32.250/daily_comming?"+ url_range[count-1]
                 day_href_obj.setAttribute("href",url_links);   
           }  
      }
    });
});


/*
$(document).ready(function(){
    $.ajax({  
      url:"http://10.255.32.250/left",  
      dataType:‘jsonp‘,  
      data:‘‘,  
      jsonp:‘callback‘,  
      success:function(result) {  
            for(var i in result) {  
                alert(i+":"+result[i]);//循环输出a:1,b:2,etc.  
            }  
        },  
        timeout:3000  
});  
})
*/

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。