Javascript 如何使用AJAX解析XML文档以查看元素是否存在,如果存在,则将其传递给PHP文件
在过去的几天里,我一直被这个问题困扰着。确切的问题是: 使用Ajax编写一个应用程序,允许用户从上面的XML输入项目名称,如果在文档中找到,则显示相关消息以及关于项目数量的信息 XML文件:Javascript 如何使用AJAX解析XML文档以查看元素是否存在,如果存在,则将其传递给PHP文件,javascript,php,ajax,xml,Javascript,Php,Ajax,Xml,在过去的几天里,我一直被这个问题困扰着。确切的问题是: 使用Ajax编写一个应用程序,允许用户从上面的XML输入项目名称,如果在文档中找到,则显示相关消息以及关于项目数量的信息 XML文件: <?xml version="1.0" encoding="UTF-8"?> <Recipe> <Name>Lime Jello Marshmellow Cottage Cheese Suprise</Name> <Description
<?xml version="1.0" encoding="UTF-8"?>
<Recipe>
<Name>Lime Jello Marshmellow Cottage Cheese Suprise</Name>
<Description>My grandma's favourite (may she rest in peace).</Description>
<Ingredients>
<Ingredient>
<Qty unit="box">1</Qty>
<Item>Lime Gelatin</Item>
</Ingredient>
<Ingredient>
<Qty unit="g">500</Qty>
<Item>Multi Coloured tiny marshmallows</Item>
</Ingredient>
<Ingredient>
<Qty unit="ml">500</Qty>
<Item>Cottage Cheese</Item>
</Ingredient>
<Ingredient>
<Qty unit="dash"/>
<Item optional="1">Tabasco sauce</Item>
</Ingredient>
</Ingredients>
<Instruction>
<step>Prepare line gelatin according to package instructions</step>
</Instruction>
</Recipe>
我想您可以从一些xml解析器开始,比如->您的尝试在哪里?我在这里看到了一个任务,但没有真正的问题。在这种情况下,问题很可能会被关闭。我的建议是添加您尝试的内容、编写的代码以及在过程中遇到的具体问题的详细信息。