在jQuery中使用远程JSON

时间:2011-12-13 09:48:45

标签: json web-services jquery jsonp

我正在使用以下代码:

$.ajax({
  url: "http://servername/public_data.json",
  crossDomain:true,
  dataType:"jsonp",
  success: function(data){
    alert(data);
  }
})

我想使用来自远程服务器但未获取数据的json。在执行上面的代码时,我的控制台告诉我:

jquery.cycle.all.latest.js:27[cycle] terminating; zero elements found by selector
Resource interpreted as Other but transferred with MIME type undefined.
Resource interpreted as Other but transferred with MIME type undefined.
Resource interpreted as Other but transferred with MIME type undefined.
Resource interpreted as Other but transferred with MIME type undefined.
Resource interpreted as Other but transferred with MIME type undefined.
Resource interpreted as Other but transferred with MIME type undefined.
Resource interpreted as Other but transferred with MIME type undefined.
Resource interpreted as Other but transferred with MIME type undefined.
bidarea:242Uncaught Error: INVALID_STATE_ERR: DOM Exception 11
Resource interpreted as Other but transferred with MIME type undefined.
public_data.json:1Uncaught SyntaxError: Unexpected token :

问题出在哪里?我该如何解决?当我在chrome响应中监视此响应时获得此响应:

{"price":22,"start_time":1323770479,"end_time":1323788469,"current_time":1323777486,"leader_list":   ["",""]}

但我该如何使用它?在哪个变量?不在数据中?

0 个答案:

没有答案