UncleEricB
11-19-2009, 01:27 AM
Hello,
Summary: I have some JS doing an AJAX call that sets a div's innerHTML properly but as soon as the JS function exits, the innerHTML resets itself.
More Detail: I have an index.php file with an <a href='' onclick="displayTask()"> link. The target code for the onclick is in an external javascript file. The JS calls a perl CGI script.
I know that the call to the external JS is working and that the perl CGI is returning the proper response. I can see this by using the Firebug add-on [I'm doing my development in Firefox 3.5.5] and setting a breakpoint within the external JS file.
You can see this all for yourself at:
http://ericatplay.com/task_organizer/index.php
// Click on "First task", "Second task" or "Third task".
The JS is here:
http://ericatplay.com/task_organizer/scripts/ajax.js
// Don't worry about usernames/passwords. They are unique to this project.
// Set a breakpoint at line 23 of ajax.js to see that the innerHTML is being set correctly.
At first blush, this looks like a scope issue to me. I tried passing in 'this' as a parameter to the JS function displayTask() but that didn't fix anything. I'm fairly new to this browser programming, coming from a server-side background.
Any help would be greatly appreciated. Let me know if you need more information.
TIA,
Eric
Summary: I have some JS doing an AJAX call that sets a div's innerHTML properly but as soon as the JS function exits, the innerHTML resets itself.
More Detail: I have an index.php file with an <a href='' onclick="displayTask()"> link. The target code for the onclick is in an external javascript file. The JS calls a perl CGI script.
I know that the call to the external JS is working and that the perl CGI is returning the proper response. I can see this by using the Firebug add-on [I'm doing my development in Firefox 3.5.5] and setting a breakpoint within the external JS file.
You can see this all for yourself at:
http://ericatplay.com/task_organizer/index.php
// Click on "First task", "Second task" or "Third task".
The JS is here:
http://ericatplay.com/task_organizer/scripts/ajax.js
// Don't worry about usernames/passwords. They are unique to this project.
// Set a breakpoint at line 23 of ajax.js to see that the innerHTML is being set correctly.
At first blush, this looks like a scope issue to me. I tried passing in 'this' as a parameter to the JS function displayTask() but that didn't fix anything. I'm fairly new to this browser programming, coming from a server-side background.
Any help would be greatly appreciated. Let me know if you need more information.
TIA,
Eric