Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Dec 5th, 2007, 6:45 PM   #11
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,730
Rep Power: 5 Sane is on a distinguished road
Re: Problem with calling a function

It's been a while since I've done any work with Ajax, but I believe, by default, Ajax is browser dependant, so you must include an external .js file that will work out the compatibility for you. Feel free to correct me of course...

I believe it was "Sarissa" that I used before.
Sane is offline   Reply With Quote
Old Dec 6th, 2007, 1:12 PM   #12
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
Re: Problem with calling a function

Quote:
You should mention the actual URL so we could look at it not working, or if it is a private page, post your current code. Also, the line number of the error would be a help.
I can't post a link since you have to actually be logged in to use the PMs feature. But here's how the code is at the moment:

<script type="text/javascript">

var xmlHttp;

function initialize(){ 

  try{
    xmlHttp=new XMLHttpRequest();    
  }catch (e){
    try{     
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
    }catch (e){      
      try{        
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
        }catch (e){
          alert("Your browser does not support AJAX!");        
          return false;        
        }      
      }    
    }  
  }

function options(cmd){

initialize();

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

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

}
</script>

Quote:
It's been a while since I've done any work with Ajax, but I believe, by default, Ajax is browser dependant, so you must include an external .js file that will work out the compatibility for you. Feel free to correct me of course...
 try{
    xmlHttp=new XMLHttpRequest();    
  }catch (e)
But this code should create the built in javascript object that firefox uses. As for Netscape i'm unsure whether that uses the js object or the activex object but my code should create whichever is needed therefore making it compatible with all major browsers.
__________________
mysql_query("DELETE chavs FROM earth") or die("chavs");
FireflyX is offline   Reply With Quote
Old Dec 6th, 2007, 4:56 PM   #13
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 799
Rep Power: 3 The Dark is on a distinguished road
Re: Problem with calling a function

I can't see anything that would cause a "length required" message. One thing you could do is debug through it using a Firefox add-on such as FireBug. This will let you step through the script and set breakpoints etc.
The Dark is offline   Reply With Quote
Reply

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 4:21 AM.

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