SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: refering to ajax loaded page

  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    refering to ajax loaded page

    Hi,

    How can I refer to inputs ina a page loaded by ajax in a div from parent and vice versa?
    I already tred parent.form.element and also opener.form.element with no luck..

  2. #2
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    once you are done with copying the ajax loaded content to some div, you can start refering to certain DOM object.

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SimplyFu View Post
    once you are done with copying the ajax loaded content to some div, you can start refering to certain DOM object.
    I´m loading the page inside a div, but I want to have access to the server side code variables on it. So I place them inside inputs (in the loaded file) and now, from parent i´m trying to reach them with no sucess by GetElementByID("inputid").
    How should I refer to it?

  4. #4
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, you can't access variable from server side. Maybe you can do something like :

    e.g. in PHP
    echo "<script>var myvar = ".$myvar_value."</script>";
    then you can access myvar in your javascript application.

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So there's no way to refer to inputs on the loaded page from parent?

  6. #6
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you using innerHTML?
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  7. #7
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kravvitz View Post
    Are you using innerHTML?
    Yes, and using post to open the page.

  8. #8
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah. That's probably your problem. innerHTML is a non-standard property. It doesn't always play nice. Be very careful how you use it. I suggest you read this: HTML text as JS string

    These links are included in that thread but I'll include them here too:
    DOM Scripting: The innerHTML dilemma
    InnerHTML is Evil
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

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
  •