SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist stef25's Avatar
    Join Date
    Nov 2004
    Location
    belgium
    Posts
    465
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    calling a js function after ajax page load

    on index.php i have a tabbed navigation menu. when the "test" tab is clicked, test.php is loaded via ajax into index.php. test.php is a short php script and an html form. the script calls a db that populates the form fields - all working fine.

    some of the form fields should be tinyMCE textareas. im "applying" tinyMCE using the standard tinyMCE.init javascript function. problem is, its not applied on these ajax pages. im not sure where to place this tinyMCE.init function. i tried on the index.php page and in the test.php page but it doesnt work.

    i can call a function when the tab gives an onShow, it works fine with a simple alert("hey"); test but when i replace the alert with the tinyMCE.init function, it still doesnt get applied

    firebug shows no errors ... can anyone tell me what im doing wrong?
    Last edited by stef25; Nov 6, 2007 at 14:01. Reason: typo
    I need someone to protect me from
    all the measures they take in order to protect me

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you load something via ajax, you get a big string returned. It's nothing like how a browser parses an HTML page when it loads. It's up to you to deal with that string as you want.

    Here is a post that may offer a quick solution (using Prototype ajax library)

  3. #3
    SitePoint Evangelist stef25's Avatar
    Join Date
    Nov 2004
    Location
    belgium
    Posts
    465
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im actually using jquery ajax which comes with a callback function (onShow) for when the external page is loaded. onShow alert("hey") works. im just wondering why that works, but the tinyMCE.init function wouldnt?
    I need someone to protect me from
    all the measures they take in order to protect me

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Prototype has something called evalScripts - does jQuery have a similar thing?

    Also, is TinyMCE defined in index.php? Probably should be if not.


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
  •