?
Solved

DOM issues with reloading jQuery, AJAX

Posted on 2014-01-07
3
Medium Priority
?
748 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 800 total points
ID: 39761484
You could try calling the $(window).load(...) function.
Could you provide any piece of the code ?
0
 
LVL 83

Assisted Solution

by:leakim971
leakim971 earned 800 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

750 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