使用JQuery将XML图像路径转换为图像
当我在我的网站上读取XML文件时,我试图将图像的路径转换为实际图像。我的XML的结构是:使用JQuery将XML图像路径转换为图像,jquery,html,xml,Jquery,Html,Xml,当我在我的网站上读取XML文件时,我试图将图像的路径转换为实际图像。我的XML的结构是: <?xml version="1.0" encoding=UTF=8?> <peopleNetwork> <person id="1"> <name>Alice</name> <friend>Ruby</friend> <image>images/ruby.j
<?xml version="1.0" encoding=UTF=8?>
<peopleNetwork>
<person id="1">
<name>Alice</name>
<friend>Ruby</friend>
<image>images/ruby.jpg</image>
</person>
<person id="2">
<name>Tom</name>
<friend>Katty</friend>
<image>images/ketty.jpg</image>
</person>
</peopleNetwork>
您只需要创建一个
“+”
);
});
}
});代码>
$("#container").append($(xmlDoc).find('person[id="1"]').text() + '<br/>')
<img src"images/' +$(this).find("image").text() + '"alt=$(this).find('person[id="1"]').text()>);
$("#container").append('<div class"peopleNetwork"><img src="images/' + $(xmlDoc).find("image").text() + alt="' + $(xmlDoc).find('person[id="1"]').text())
Uncaught ReferenceError: Invalid left-hand side in assignment