Answer the question
In order to leave comments, you need to log in
Why does the browser freeze when processing a file with a JS script?
Good afternoon everyone!
The task was to pull out a description of goods from a third-party supplier's website. There were a lot of goods (more than 1000), I wrote a parser to collect descriptions of positions. The JS script collected information, when it collected it, it converted the data to JSON (used JSON.Stringify), sent the script to PHP and wrote it to a file, because JS cannot write to a file. I am now working with this file to parse descriptions, process them, etc. The file has the following structure:
[
["\n \n <div><p><br></p><div>Всякое описание текста.</div><div><br>Производитель: Такой-то</div><div> <br>Доп параметры.</div><div><br>Дата производства: 2012г. <br><br>Еще что-то .</div><div> </div></div>\n\n \n ","\n \n <div class=\"ty-product-feature\">\n <span class=\"ty-product-feature__label\">Страна:</span>\n\n \n <div class=\"ty-product-feature__value\">Китай</div>\n </div>\n \n \n \n "],
["\n \n <div><p><br></p><p>О товаре<br></p><div>Описание</div><div>Еще всякое.</div><div>Еще чуть-чуть текста <br>Еще</div><div>Описание вновь <br>Еще параметр</div></div>\n\n \n ","\n \n <div class=\"ty-product-feature\">\n <span class=\"ty-product-feature__label\">Страна:</span>\n\n \n <div class=\"ty-product-feature__value\">Китай</div>\n </div>\n \n \n \n "]
]
jQuery.ajax({
type: "GET",
url: "price-list-parsed-BT_21-Apr-17--17-41-36.txt",
dataType: "json",
error: function() {
console.log("Не вышло");
},
success: function(temp) {
newArr = temp;
for (var i=0; i<newArr.length; i++) {
workArr[i] = [];
for (var j=0; j<newArr[i].length; j++) {
workArr[i][j] = jQuery(newArr[i][j]); //***
}
}
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question