$ (function () {$ ("Body"). On (" Change","#file", Function (Event) {UploadFile ( This,Event); }) function UploadFile () {varFiles =Event. target.files, file; if(Files && files.length >0) { //get the currently uploaded fileFile = files[0]; //look at the console and see exactly what this object is.console.log (file); //so we can do something like file size check.//Gets the URL tool for window varURL = window. URL | |Window.webkiturl; //generating a destination URL from file varImgurl =url.createobjecturl (file); Console.log (Imgurl); $.Get(Imgurl,function (xmldoc,textstatus) {//Find searches all elements that match the specified expressionConsole.log (xmldoc); var$provinceElement =$ (xmldoc). Find ("Province"); Console.log ($provinceElement. length); $provinceElement. Each (function (Index,domele) {var$city =$ ( This). Find (" City"); Console.log ($city. length); $.each ($city, function (index,domele1) {Console.log ($ (domEle1). Text ( )); }); }); }); } }
JS get local file and parse file contents (xml,txt)