Solved

DOM issues with reloading jQuery, AJAX

Posted on 2014-01-07
3
690 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
session dropped in IE 10 20
Editing login page in zencart. 2 14
Instering to MySQL table 5 16
Jquery form submit not working ? 7 16
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

705 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

14 Experts available now in Live!

Get 1:1 Help Now