1
$(document).ready(function() {
var path = null;
console.log('${pageContext.request.contextPath}/loadfile');
$.ajax({
dataType: "json",
url: '${pageContext.request.contextPath}/loadfile',
success: function(data){
$.each(data,function(index,obj){
console.log(obj.id);
alert('inside');
path = obj.path;
});
}
});
here/loadfile是返回json对象的url,当我转到此url时,我能够看到打印在html页面上的JSON对象,但是当我访问包含上面的JavaScript代码的页面时,我没有得到相同的结果我无法接收从我的servlet发送的json对象
你在开发工具中看到了什么? – SLaks 2013-02-10 14:09:27
'console.log(data)'显示什么? – 2013-02-10 14:09:48
它们是否在开发工具的网络选项卡中有任何请求,它的响应是什么? – edi9999 2013-02-10 14:10:26