We have an web app where client side JavaScript is开发者_如何转开发 used heavily and ONLY works in IE (All versions). However, we want to make these JavaScripts browser independent. We use Microsoft technologies such as Asp.net/Classic asp etc.
We have mostly used XML (using activeX object such as new ActiveXObject("Microsoft.XMLDOM")
) in JavaScript to:
- Get data from server in XML format
- Load to XMLDocument
- Parse the document
- Transform the document using XSLT
How can we make these above steps browser independent? Which Jquery plugins we should use to transform xml?
Can anyone help us?
jQuery can handle the first three items natively:
Use $.ajax() to get data from the server.
You can parse the xml using jQuery's standard selectors.
I don't have any experience with using it to apply XSLT, but I see that there is a plugin that looks promising:
http://www.jongma.org/webtools/jquery/xslt/
For Ajax calls you can use jquery API (XML is only one of the data types): http://api.jquery.com/category/ajax/. This API allows easy cross domain ajax calls As well as easy parsing and access to the returned data (XML formatted). Here ius a simple example: http://www.switchonthecode.com/tutorials/xml-parsing-with-jquery
For the transformation you can use one of numerous jquery plugins :
- http://plugins.jquery.com/project/XSLTTemplater
- http://www.jongma.org/webtools/jquery/xslt/
- http://plugins.jquery.com/project/Transform
Hope it helps.
精彩评论