I
I
Ivan Damaskin2016-04-09 10:19:52
JavaScript
Ivan Damaskin, 2016-04-09 10:19:52

How to make a variable visible in javascript after the template is loaded?

Hello.
I have a view items
in it, I load 3 more
- article
- comments
- form with comments

I write ajax pfghjc for likes in comments. But after loading the view with comments, it does not seem to see my links with the id to which I tie up the ajax request. What could be the problem? Who will help? -)

Thanks to everyone who will respond.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DireX, 2016-04-09
@xDireX

The problem is that after loading you need to re-bind the DOM to the events.

A
Alexander, 2016-04-09
@lasmaster

No need to rebind events. It is possible to initially bind events and they will work even for those elements that are dynamically loaded into the DOM. To do this, use the jQuery on method: jqapi.com/#p=on

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question