cannot read property createdocumentfragment of undefined

Я пытаюсь захватить веб-страницу и загрузить в загрузочный файл 2.3.2 popover. До сих пор я:

Когда я активирую этот код, я получаю ошибку:

Uncaught TypeError: Не удается прочитать свойство ‘createDocumentFragment’ undefined

В чем проблема и как ее исправить?

Причиной ошибки является $(this).html($link); в вашем обратном вызове .done() .

this в обратном вызове относится к [. ]object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax)[. ] , а не к $(«.btn.btn-navbar») (или то, что вы ожидаете там, где оно должно ссылаться).

Ошибка вызывается из-за того, что jQuery будет внутренне вызывать .createDocumentFragment() на ownerDocument объекта, который вы передаете с this при выполнении $(this).html($link); , но в вашем коде this не является DOMElement и не выполняет имеют ownerDocument . Из-за этого ownerDocument есть undefined , и именно по этой причине createDocumentFragment вызывается на undefined .

Вам нужно использовать параметр context для вашего запроса ajax . Или вам нужно сохранить ссылку на DOMElement, который вы хотите изменить, в переменной, к которой вы можете получить доступ в обратном вызове.

Не пойму из-за чего ошибка
Uncaught TypeError: Cannot read property ‘ajax’ of undefined

  • Вопрос задан более трёх лет назад
  • 4354 просмотра

Код должен быть обернут

Так же проверь что $ никто не переопределяет

I am trying to reformat the table by doing some changes in the existing table in my application. I have searched on internet for below error but I haven’t found any solution for this.

Error I am getting is as below:

Cannot read property ‘createDocumentFragment’ of undefined

Getting error on below line

Code I am using from the question posted on below

Please guide me If I am doing anything wrong here.

Содержание

  1. 1 Answer 1
  2. Not the answer you’re looking for? Browse other questions tagged javascript jquery html or ask your own question.
  3. Linked
  4. Related
  5. Hot Network Questions

1 Answer 1

The error seems to be triggered on $(this).html() , because this does not refer to a DOM element. You are using this in a normal for loop, while you probably intended it to be used in a jQuery each loop callback.

NB: You should really reconsider if the erroneous code you received as an answer deserved to be marked accepted.

Not the answer you’re looking for? Browse other questions tagged javascript jquery html or ask your own question.

Linked

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2019 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2019.11.15.35459

Источник: computermaker.info

Понравилась статья? Поделиться с друзьями:
Ок! Компьютер
Добавить комментарий