?
Solved

DOM issues with reloading jQuery, AJAX

Posted on 2014-01-07
3
Medium Priority
?
728 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 82

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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 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