Solved

DOM issues with reloading jQuery, AJAX

Posted on 2014-01-07
3
694 Views
Last Modified: 2014-03-02
I am working on a site that is using AJAX for page loading.
problem is, some pages have js elements that need to be call after the DOM is loaded, for example: Google maps. If I do a page refresh, all works fine.

Is there a way I can reload a page and scripts into the DOM without actually refreshing the page itself?
0
Comment
Question by:Sam Cohen
3 Comments
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 200 total points
ID: 39761484
You could try calling the $(window).load(...) function.
Could you provide any piece of the code ?
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 200 total points
ID: 39761736
If I do a page refresh, all works fine.

look like your browser cache some external resources and your page load quickly

Is there a way I can reload a page and scripts into the DOM without actually refreshing the page itself?

Open in new window


no, all part of your code which need to wait for DOM loaded should be reside in an or multiple init function so you can call :

$(document).ready(function() {
    init1();
    init2();
    init3();
    initN();
});

Open in new window

0
 
LVL 8

Author Closing Comment

by:Sam Cohen
ID: 39899395
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now