使用这样如何使用本地.json文件和jQuery获取json对象的Ajax响应?
$.ajax({
url: 'mydata.json',
type: 'get',
error: function(data){
},
success: function(data){
data=jQuery.parseJSON(data);
//do something with data
}
});
它工作时,我实现它与服务器的URL,其内部生成JSON响应对象并返回服务器,除了完美的jQuery Ajax请求。那么我不需要jQuery.parseJSON(数据)。有没有一种方法可以使用本地json文件并获得响应作为json对象?