SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2010
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ajax content that contains internal javascript is not functioning.

    Put simply:

    I have content coming in from an Ajax request. There are internal js variables being set on the page that don't seem to be registering. As a matter of fact, as a test, I can't even get an alert box to fire up. Though, when I run the page directly the alert triggers fine.

    It's obvious I'm misunderstanding some basic information about Ajax calls, haha. What am I missing?

    Thanks,
    Paul

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,194
    Mentioned
    17 Post(s)
    Tagged
    4 Thread(s)
    The JavaScript on the page requested will not be executed. You will need to manually execute it once the page is retrieved via the AJAX call. If you are using JQuery the method html() does just that otherwise you can eval() the content yourself.
    The only code I hate more than my own is everyone else's.

  3. #3
    SitePoint Member
    Join Date
    Apr 2010
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    The JavaScript on the page requested will not be executed. You will need to manually execute it once the page is retrieved via the AJAX call. If you are using JQuery the method html() does just that otherwise you can eval() the content yourself.
    Awesome! I'll give it a shot.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •