![]() |
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">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 |
Re: Problem with calling a function
Try replacing the call to initialize() with
window.onload = initialize;. |
Re: Problem with calling a function
Thanks for the reply but that didn't seem to make a difference. I can fix the problem by just putting the code for that function in each time i wish to use it but that seems very inconvinient :(
|
Re: Problem with calling a function
Try moving
var xmlHttp; outside the scope of the function. Make it the first line of the code, and not within the function call. I think that's because mail() refers to xmlHttp, but xmlHttp expires once initialize() ends. |
Re: Problem with calling a function
you know what.. that just worked! Thanks for the help my site now has a pm system with no page reloads :D
|
Re: Problem with calling a function
Sane is correct...O great PHP god :icon_rolleyes:
I'd suggest the Firebug extension for Firefox (includes javascript debugging, a javascript command line, and can show ajax requests real time, among other things). This would have told you that initialize() was actually getting called. It would also be much less painful to use a library such as prototype or jQuery jQuery equivalent looks something like this. Warning: Untested. :
|
Re: Problem with calling a function
Quote:
Perhaps i should look at getting this Firebug extension you speak of as it sounds like it could be useful. |
Re: Problem with calling a function
Yep. I use that (although I didn't have to in this case). Mine's called the Web Developer extention, very handy. But Dameon could be referring to something similar.
|
Re: Problem with calling a function
Hi again sorry to bump this thread back up but i thought this was working fine till a friend told me he was getting errors from it. I tested the system on a few browsers and it was fine on IE7, Opera and Safari but on Firefox and Netscape it just comes up with "Length required". Can anyone tell me why this might happen? Thanks
|
Re: Problem with calling a function
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.
|
| All times are GMT -5. The time now is 1:06 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC