Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Nov 30th, 2007, 4:37 PM   #1
FireflyX
PHP God
 
FireflyX's Avatar
 
Join Date: Nov 2007
Location: Stockton, England
Posts: 15
Rep Power: 0 FireflyX is on a distinguished road
Send a message via MSN to FireflyX
Question Problem with calling a function

Ok just a quick question.. after sitting here for about half an hour trying to work out what's wrong with this script i come here in seek of guidence.

<script type="text/javascript">

function initialize(){ 

  var xmlHttp;
  try{
    xmlHttp = new XMLHttpRequest();    
  }catch (e){
    try{     
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");      
    }catch (e){      
      try{        
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");        
        }catch (e){
          alert("No ajax!");        
          return false;        
        }      
      }    
    }  
  }

function mail(){

initialize();

xmlHttp.onreadystatechange=function()
  {
  if(xmlHttp.readyState == 4)
    {
    document.getElementById("show_box").innerHTML = xmlHttp.responseText;
    }
  }

xmlHttp.open("GET","http://www.staticfire.co.uk/ajaxrequest.php?cmd=mail",true);
xmlHttp.send(null);

}

</script>

The problem seems to be that it isn't recognising the initialize() function. But if i replace where i call the function with the code for that function it all runs fine. Am i missing something obvious here?

-Thanks, Firefly
FireflyX is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling an undeclared or undefined function in C/C++ climbnorth C 2 Oct 8th, 2006 12:02 AM
problem with a function brad sue Other Programming Languages 3 Apr 23rd, 2006 10:24 PM
problem with standard function sparda C 8 Oct 26th, 2005 2:27 PM
Problem passing multi-dimensional array to function aznluvsmc C 2 Aug 30th, 2005 10:00 PM
Problem when returning a string from a function in VC++ vjkancha C++ 10 Mar 7th, 2005 1:18 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:05 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC