Passing Javascript code in an XMLHttp Request

Discussion in 'JavaScript' started by quaffapint, Feb 13, 2007.

  1. #1
    I'm trying to determine the best way to pass javascript code that includes a link to a different javascript file through an xmlhttp request.

    For example, say I want to pass...

    <script>
    stuff
    </script>
    <script src="http://someserver.com/somescript.js></script>

    ...How would I pass that and execute it. Would an 'eval' be appropriate for this?

    Thanks for any thoughts...:)
     
    quaffapint, Feb 13, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Maybe with Ajax.Updater function from prototype.js library.
    Try using url=http://someserver.com/somescript.js, and adding evalScripts:true to the list of properties in the last argument of the object constructor.
     
    ajsa52, Feb 13, 2007 IP
  3. quaffapint

    quaffapint Active Member

    Messages:
    299
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #3
    I'll check into it - thanks...
     
    quaffapint, Feb 13, 2007 IP
  4. quaffapint

    quaffapint Active Member

    Messages:
    299
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Bummer doesnt look like it will work with a remote javascript src...
     
    quaffapint, Feb 13, 2007 IP