?
Solved

on page added content

Posted on 2014-10-09
1
Medium Priority
?
77 Views
Last Modified: 2014-10-17
I have a function which adds action events onto classes, however I pull in data from ajax calls very rarely redrawing the entire page. Currently at the end of each ajax event I call a function doOnLoad() and in there I do all the changes. For example everything with the .tabbed class gets drawn into a tabbed view. Instead of putting this line in is there an event that when the page has content added a function can be called?
0
Comment
Question by:tonelm54
[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
1 Comment
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 2000 total points
ID: 40370127
The safest and transparent way is as you're doing it.
I don't like to hide things behind the scenes that will be later harder to understand and debug.

Anyway, the alternative is to catch all the ajax responses (successes) and act upon.
Here's the jquery documentation for it: http://api.jquery.com/ajaxSuccess/

The basic idea it to attach an ajaxSuccess event handler to the page document.
Here's a snippet taken from the doc:
$(document).ajaxSuccess(function() {
  // probably you need to validate is the ajax request is the one you want and...
  doOnLoad();
});

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
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…
Suggested Courses
Course of the Month9 days, 5 hours left to enroll

765 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