[Wylug-help] AJAX, JS and scoping

Dave Whiteley d.l.whiteley at ee.leeds.ac.uk
Fri Aug 17 12:01:03 BST 2007


On Friday 17 August 2007 11:22, Gary Stainburn wrote:
> Hi folks.
>
> Having another go with AJAX and trying to create a library function based
> on a tutorial I've been looking at.
>
> However, It's not working and I think it's a javascript scoping issue. In
> the call-back function it's complaining that xmlHttp doesn't exist when I
> try to check that readyState == 4.
>
> AjaxRequest itself is obviously working as it should, but how to I make the
> xmlHttp created by it available to the call-back?
>
<snip/>

Gary,

A suggestion.  I struggled by using bare ajax stuff, until I discovered that 
the world became a lot nicer if you used one of the ajax development kits.  
These have the huge advantage that topics such as browser dependancies are 
already dealt with.

I chose to use Mochikit - which works well for me.   http://mochikit.com/

With Firefox this also provides a very useful debugging capability which means 
that you can avoid the dreadful debugging by alert. 

Dave
Hope this helps

-- 

Dave Whiteley
d.l.whiteley at ee.leeds.ac.uk
Phone +44 (0)113 343 2059
Faculty of Engineering
The University of Leeds. Leeds, LS2 9JT,  UK



More information about the Wylug-help mailing list