首页 > 代码库 > jsonp AND ajax
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 = http://www.mamicode.com/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 }); }) */
jsonp AND ajax
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。