我正在尝试使用ajax调用我的web服务。我已经在虚拟机中部署了我的web服务。
URL:
http://www.lumiin.ch:8080/lumiin-service/lumiin/control/vprospects
用Rest客户端Jar尝试这个URL
Method = GET
Key = accept
value = Application/json
**My Code below**
$.ajax({
type: "GET", //GET or POST or PUT or DELETE verb
url: "http://www.lumiin.ch:8080/lumiin-service/lumiin/control/vprospects", // Location of the service
data: "", //Data sent to server
contentType: "application/json", // content type sent to server
dataType: "json", //Expected data format from server
processdata: true, //True or False
success: function (data) {//On Successfull service call
var result = json.name;
alert("result===" + result);
$("#dvAjax").html(result);
},
error: ServiceFailed// When Service call fails
});
return false;
});
});但是我没有从上面的代码中得到任何回应。请帮帮我。
雷德·卡鲁普
发布于 2012-11-20 05:58:06
这似乎与jQuery所做的jQuery请求有关。可能是在找callback=?
尝试添加以下内容
$.ajax({
jsonp :false,
-- other params here--
});http://api.jquery.com/jQuery.getJSON/
发布于 2012-11-20 05:58:42
你试过改变这一行吗?
var result = json.name;对此:
var result = data.name;这是:
error: ServiceFailed对此:
error: function(){ alert('ServiceFailed');}试着看看这是否能解决你的问题。
https://stackoverflow.com/questions/13467185
复制相似问题