2

Here's the fiddle:

http://jsfiddle.net/k2CAs/

(I want to test if and how ajax requests for svg are handled differently from inline svg.)

The console says there's an error. But I've read through the xml and svg headers carefully and I don't see a typo. Is this an issue with jsfiddle itself or am I doing something wrong? Is this just another case of jquery not playing well with svg? Help very appreciated...

UPDATE: D'oh! I fixed the typo, and reduced the number of svg elements for simplicity but the xml response logged in the console is null:

http://jsfiddle.net/k2CAs/4/

I've fiddled and fiddled with the various content and data settings. Is there some special way I need to set up the posted svg to deserialize correctly to xml? Is that not handled by jquery? (And yes, I've looked carefully at the jquery ajax docs.)

4

1 回答 1

0

你有xml: "<?xml version="1.0" ...</svg>"

此字符串由双引号(: 之后的那个)限定,但内部也包含双引号,因此它不会像您认为的那样做。

解决方案是对数据使用一种引号类型(单引号或双引号),另一种将其作为字符串包含。在这种情况下,最简单的解决方案是替换初始和最终引号,这样您就可以:

xml: '<?xml version="1.0" ...</svg>'

于 2012-06-12T09:16:31.070 回答