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
Solved

DOM issues with reloading jQuery, AJAX

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

840 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