当前位置: 代码迷 >> JavaScript >> 用js获取后盾数据,并返回数据
  详细解决方案

用js获取后盾数据,并返回数据

热度:178   发布时间:2012-06-22 16:16:32.0
用js获取后台数据,并返回数据
我自己写的html码如下:
 <img id="BTImg" src="" width="623px" height="420px" style="z-index:1; position:absolute; margin:1px 0 0 0px; ">


JS代码:var GetBTImg = function(){
  $.ajax({
  url:'http://news.guet.cn/bcapi.asmx/next',
  type: 'POST',
  dataType: 'json',
contentType: "application/json; charset=utf-8",
data: "",
  error: function(json){
   
  },
  success: function(json){
var jsonData = eval('('+json+')');
 
$('#BTImg').attr('src',jsonData.str);


}
  });
};


后台数据:<string xmlns="http://tempuri.org/">
{"str":"http://news.guet.edu.cn/BeautyAPI/image/15550.jpg"}
</string>

------解决方案--------------------
直接返回{"str":"http://news.guet.edu.cn/BeautyAPI/image/15550.jpg"}
就可以实现了
  相关解决方案