'Jquery on curl fetched data
I have a div which is being populated through curl from another html page. Now the data is populating correctly but I want to use jQuery or Javascript on the ids or classes of the fetched data. I tried using livequery, binding but of no use. Can you please help me?
Solution 1:[1]
Basically you're trying to bind to elements that do not yet exist. JavaScript works directly on the DOM (Document Object Model). What that means, is that whenever a specific element does not yet exist in the DOM, JavaScript can't bind to it.
Using jQuery does not change this, or (at best) only does so under very specific circumstances. I would just write a wrapper function in which you bind to the new elements, that you call after the AJAX request was completed successfully.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Edwin Dijk |