当我尝试从第二个 url 获取数据时,我在 firebug 中遇到错误,但是当我尝试评论中的 url(第一个)时,一切正常,
function build()
{
$.ajax({
type: "GET",
contentType: "application/json",
crossDomain: true,
/// url: "http://localhost:9100/todo-0.1/data.json",
url:'localhost:9000/rest/admin/component?componentUri=file:/home/workspace/app/5-Integration/',
dataType: "json",
success: function (data)
{
var n=data.links.link[1]['@href'].indexOf("file");
var ContObject=new Object();
ContObject.data=new Object();
ContObject.data["title"]= decodeURI(data.links.link[1] ['@href'].substring(n));
ContObject.state="open";
ContObject.metadata=new Object();
ContObject.metadata["id"]= decodeURI(data.links.link[1]['@href'].substring(n));
var jsonText = JSON.stringify(ContObject);
var output="<div>";
output+= jsonText;
output+="</div>";
document.getElementById("placeholder").innerHTML=output;
alert("success");
},
error: function (data,status)
{
console.log("ERROR");
console.log(status);
}
});
谢谢指导