javascript - Reading XML with jQuery and AJAX Unsuccessful -


i've been trying load xml standalone html page. since i'm working standalone computers well, have neither internet connection nor server files, xmlhttprequest doesn't work. i've read here can use jquery ajax load xml html, reason won't load information stored on it, if use codes i've found here.

i've downloaded jquery library jquery site, , based on found here code looks this:

$(document).ready(function(){     $.ajax({         type: "get",         url: "myxml.xml",         datatype: "xml",         success: function(xml) {             var myxml = $(xml).data();         }     }); }); 

when time being i'm trying read data, not use it. myxml doesn't have data begin @ moment (like said, actual xml on standalone), how looks:

<?xml version="1.0" encoding="utf-8"?> <type>     <type id="1">         <model> lenovo </model>         <year> 2015 </year>     </type>      <type id="2">         <model> iphone </model>         <year> 2014 </year>     </type> </type> 

not code doesn't work, html page ignores every script written afterwards, including alert() or write(). have solution that?

function readxml() {     $.ajax({         type: "get",         url: "myxml.xml",         datatype: "xml",         success: function (xml) {             var typearr = $(xml).children(); //give type id array             var id=typearr[0].attr('id'); // 1             var type_0_childern =  typearr[0].childern();          }     }); } 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -