AJAX Forums

Importing Javascript from an AJAX call

This is a discussion on Importing Javascript from an AJAX call within the AJAX Implementation forums, part of the Advanced Ajax category; Hi all I am using AJAX to return the content of another page and then I put the returned content into the innerHTML of a div on the calling page. ...

Go Back   AJAX Forums > Advanced Ajax > AJAX Implementation

AJAX Made Easy


AJAX Implementation Discuss on AJAX Implementation

Reply

 

LinkBack Thread Tools Display Modes
Old 05-14-2009, 04:00 AM   #1 (permalink)
Junior Member
 
Join Date: May 2009
Posts: 1
Rep Power: 0
kvheerden is on a distinguished road
Importing Javascript from an AJAX call

Hi all

I am using AJAX to return the content of another page and then I put the returned content into the innerHTML of a div on the calling page. I use this for example when asking a user to complete a form. My issue is if I define a javascript function in the page I'm calling with JavaScript, it will not be available on the page I have my div on (the calling page). My solution for this is to extract the javascript functions from the content returned by the AJAX call and "import" it into the calling page using eval.

This solution does work, but I'm curious if there is not a better way to handle this, as it appears the eval might be causing a memory leak if called too often.

Please let me know if you have any suggestions.
kvheerden is offline   Reply With Quote
Sponsored Links
Old 07-13-2009, 06:42 PM   #2 (permalink)
Junior Member
 
Join Date: Jul 2009
Posts: 3
Rep Power: 0
griffinmt is on a distinguished road
As a secondary 'warning' about using .innerHTML to load a div, be aware that the various browsers do this differently, and most do not rescan the imported html and update the dom tree (or do it badly). You also may get errors if running in STRICT mode on IE since it seems to want to translate all the new tags to upper case.
griffinmt is offline   Reply With Quote
Reply

Bookmarks


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


Similar Threads

Thread Thread Starter Forum Replies Last Post
How to call a servlet from jsp using ajax Preethi AJAX Help 0 02-12-2009 08:03 AM
Importing XML into MySQL table? multiz_com XML and XSLT 0 06-10-2007 03:35 PM


All times are GMT -4. The time now is 08:23 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0
Copyright ©2006 - 2009, AJAXwith.com