Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

passing an array of functions as an argument

Avatar of walkman69
walkman69 asked on
2 Comments1 Solution233 ViewsLast Modified:
Hi guys.

I have made something like this:

function init()
	var gnu = [init_function_01(), init_function_02()];
	ajax_get_page("some_page_01.php", "", "content_center", gnu);

function init_function_01() {

function init_function_02() {

function ajax_get_page(page, arg, elem, init_functions) {
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	else {
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
			for(x = 0; x < init_function.length; x++) {

The init-function is called on load.

So I try to get a page and place the output inside an HTML-element called content_center,
and if the page has been correctly loaded, a couple of functions are supposed to be called.
However.. this doesn't work since the functions are called on start. And then they aren't called at all.. I think I lack some knowledge here..

Anyone got a good solve for this?

Avatar of walkman69

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers