Показать сообщение отдельно
  #4 (permalink)  
Старый 04.04.2016, 13:31
Профессор
Отправить личное сообщение для Dilettante_Pro Посмотреть профиль Найти все сообщения от Dilettante_Pro
 
Регистрация: 27.11.2015
Сообщений: 2,899

Jigan2,
http://api.jquery.com/load/
Цитата:
 Script Execution

When calling .load() using a URL without a suffixed selector expression, the content is passed to .html() prior to scripts being removed. This executes the script blocks before they are discarded. If .load() is called with a selector expression appended to the URL, however, the scripts are stripped out prior to the DOM being updated, and thus are not executed. An example of both cases can be seen below:

Here, any JavaScript loaded into #a as a part of the document will successfully execute.

$( "#a" ).load( "article.html" );
However, in the following case, script blocks in the document being loaded into #b are stripped out and not executed:

$( "#b" ).load( "article.html #target" );


Таким образом, при load с указанием селектора скрипт не просто не работает, а удаляется из загружаемого контента.
Как вариант выхода из ситуации - грузить без селектора страницу, в которой размещено только нужное
Ответить с цитированием