JSONP格式输出


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus"/>
  <meta name="Author" content=""/>
  <meta name="Keywords" content=""/>
  <meta name="Description" content=""/>
  <script type="text/javascript" src="jquery-1.6.1.min.js"></script>
  <script type="text/javascript">
  function onFlag() {
	  $.ajax({
			type:"get",  
			url:"http://xxxx/api/hq/npdata.do?ids=1&JSONP=?",  
			dataType:"jsonp",  
			jsonp:'jsonpcallback',  
			success:function(data){  
			   alert(data[0].percent);
			}
	  });
  }

  function onehhh() {
	  $.ajax({
			type:"get",  
			url:"http://xxxx/api/hq/mtdata.do?ids=1&JSONP=?",  
			dataType:"jsonp",  
			jsonp:'jsonpcallback',  
			success:function(data){  
			   alert(data.datas);
			   for(var i=0;i<data.datas.length;i++){
				alert(data.datas[i].open);
			   }
			}
	  });
  }

  </script>
 </head>

 <body onload="onehhh()">
  
 </body>
</html>


猜你喜欢

转载自xuyiooo.iteye.com/blog/1947216