Speech about this library. Connect it. Now if we place this link code on the page:

<a ic-post-to="/click">Link</a> 

Then he turn into this:

 <a ic-post-to="/click" ic-src="/click" ic-verb="POST" ic-trigger-on="default" ic-deps="ignore" ic-id="7">Link</a> 

New attributes - this tells us that the library is working.

Now to the point. A similar link is in the HTML code, which is dynamically loaded onto the page. And the bottom line is that as a result, exactly the same html link code is placed in the source code of the page, which I pass from the back-end. That is, all these attributes in the link, which the library substitutes for its work - they are not. Library is not working. Yes, and clicking on the link does not leave anything.

That is, if to speak briefly, the library is not initialized at this moment.

How to fix? Help me please.

  • Well, it sounds simple enough - you need to call intercoolerjs in order for it to go through html and replace the necessary blocks with its own. Usually this is done using callback after ajax request (which will return to you not yet processed intercoolerjs html). Surely this method has a method that runs its handler for a certain piece of code (it did not work with it itself, but other parsers work by a similar principle) - alexoander
  • As it seemed to me, this is an Intercooler.refresh (eltOrPath) request or an Intercooler.processNodes (elt) ( intercoolerjs.org/docs.html ) - alexoander

1 answer 1

Well, it sounds simple enough - you need to call intercoolerjs in order for it to go through html and replace the necessary blocks with its own. Usually this is done using callback after ajax request (which will return to you not yet processed intercoolerjs html). Surely, this method has a method that runs its handler for a certain piece of code (it did not work with it itself, but other parsers work by a similar principle).

This can be an Intercooler.refresh(eltOrPath) request Intercooler.refresh(eltOrPath) or Intercooler.processNodes(elt) (intercoolerjs.org/docs.html).

In fact, after Ajax you add new HTML to the existing one in any container. Then (preferably if the container is with id or at least with class ) you pass this container to the input to these functions from the intercooler (since it is inherited from JQuery, you can immediately search using selectors like ".class" )