D
D
doctor__232020-06-14 16:49:27
JavaScript
doctor__23, 2020-06-14 16:49:27

Why does jquery stop working when refreshing a page via ajax?

Friends, hello!

Here is a question. Jquery code stops working when refreshing a page via ajax? JS works but JQ doesn't.
In principle, I understand why it does not work.
Since wrapped in . The ready event doesn't happen without a render. How can this be bypassed? Opencart 3 engine $(document).ready(function()

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
doctor__23, 2020-06-15
@doctor__23

Issue resolved.
I copied all the code into the script tag in the HTML document without the ready event and it all worked :)
Thank you all! :)

M
Maxim Pak, 2020-06-14
@PML

1. What are the errors in the firebug?
2. If your home content changes after an ajax request, one or another method declared in $(document).ready(function() does not know anything about the new home element that has appeared.

M
MaxFx2, 2020-06-15
@MaxFx2

Everything that you need to work with Ajax, you need to copy into the success function of Ajax. Although the entire ready can be dragged (but it’s better not to)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question