【发布时间】:2017-06-02 02:51:24
【问题描述】:
AJAX 调用有问题。解析错误。我的代码:
$.ajax({
type: "GET",
url: "http://localhost:8089/SpringNew/tesget",
dataType: "jsonp",
contentType: "application/json; charset=utf-8",
success: function(resp){
alert("Server said123:\n '" + resp );
},
error: function(request, errorText, errorCode){
alert('Error121212: ' + errorText);
}
});
当我使用此代码时,错误提示“Error121212: parseerror”,当我使用 dataType:“json”时,我有错误:“XMLHttpRequest cannot load”。
我使用 Java Spring 创建了 Web 服务,在 Web 服务中,我在端口 8089 中运行,在前端(我使用 SAPUI5)中在端口 8080 中运行。
我的网络服务:
如何解决这个问题?
谢谢。 鲍比
【问题讨论】:
-
learn.jquery.com/ajax/working-with-jsonp 尝试设置回调方法
jsonp: 'callback'
标签: json ajax spring web-services sapui5