Отправьте данные файла (без использования файла типа) на document.ready или загрузку окна [дубликат]

  jQuery (". custom-filter-options .sbHolder ul li a"). each (function () {var myStr = jQuery (this) .text (); var myArr = myStr.split ("(  "), url = 'ваш url'; // New Code data = myArr [0]; try {jQuery.ajax ({url: url, context: this, type: 'post', data: data, success: function (  data) {if (data) {jQuery (this) .html (data);} else {jQuery (this) .html (myArr [0]);}}};} catch (e) {}}); [  ! d0] 
8
задан user986959 14 January 2014 в 17:06
поделиться

1 ответ

Вы можете запустить хром-браузер с флагом --allow-file-access-from-files, использовать fetch() из XMLHttpRequest() для запроса файла из локальной файловой системы.

fetch("file:///path/to/file")
.then(response => response.arrayBuffer())
.then(ab => {
  // do stuff with `ArrayBuffer` representation of file
})
.catch(err => console.log(err));

См. также Чтение локального XML с JS

3
ответ дан Community 17 August 2018 в 12:50
поделиться
Другие вопросы по тегам:

Похожие вопросы: