Loading ...
Sorry, an error occurred while loading the content.

Help Need -- php -- yui ajax

Expand Messages
  • ankitkhera
    Hi I am making use of YUI --- to make ajax call to my server side script(php) it works fine but the events on the html(combo boxes etc) returned by server
    Message 1 of 5 , Mar 30, 2008
    • 0 Attachment
      Hi
      I am making use of YUI ---> to make ajax call to my server side script(php) it works fine
      but the events on the html(combo boxes etc) returned by server script do not work below is
      the details description please help...

      A.html makes a ajax call to B.php?userid=123 passing userid as querystring. Now B.php
      makes use of this userid and gets data from a dataSource like mysql and then generates a
      html form .... with combo buttons , textboxes etc and sets them with values got from data
      source. This response (html as string)is received by A.html page by var response=
      o.responseText and then this value is displayed in A.html using
      document.getElementById("resp").innerHTML = response, "resp" is a <div id="resp"> where
      the server response is to be displayed; Now here begins the problem if i change any value in
      the combo boxes which were generated by B.php(Server script) in A.html(response data) the
      change is not reflected in dataSource.....because these boxes were generated in B.php and
      the onchange event is also there ? How do i solve this problem

      Thanks in Advance
      Ankit.
    • Greg Skluzacek
      Sounds like the page may be cached... have you tried clearing the browser s cache to see if that fixes the problem. If it does, then try insering some headers
      Message 2 of 5 , Mar 30, 2008
      • 0 Attachment
        Sounds like the page may be cached... have you tried clearing the
        browser's cache to see if that fixes the problem. If it does, then
        try insering some headers in your a.html page that tell the browser
        not to cache it. In php you would uses something like this... there
        may be similiar meta tags to do this, but I'm not sure:

        header('Cache-Control: no-cache, must-revalidate');
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');

        Regards,
        -- Greg

        --- In ydn-javascript@yahoogroups.com, "ankitkhera" <kheraankit@...>
        wrote:
        >
        > Hi
        > I am making use of YUI ---> to make ajax call to my server side
        script(php) it works fine
        > but the events on the html(combo boxes etc) returned by server
        script do not work below is
        > the details description please help...
        >
        > A.html makes a ajax call to B.php?userid=123 passing userid as
        querystring. Now B.php
        > makes use of this userid and gets data from a dataSource like
        mysql and then generates a
        > html form .... with combo buttons , textboxes etc and sets them
        with values got from data
        > source. This response (html as string)is received by A.html page
        by var response=
        > o.responseText and then this value is displayed in A.html using
        > document.getElementById("resp").innerHTML = response, "resp" is a
        <div id="resp"> where
        > the server response is to be displayed; Now here begins the
        problem if i change any value in
        > the combo boxes which were generated by B.php(Server script) in
        A.html(response data) the
        > change is not reflected in dataSource.....because these boxes were
        generated in B.php and
        > the onchange event is also there ? How do i solve this problem
        >
        > Thanks in Advance
        > Ankit.
        >
      • Ankit Khera
        Hi, Thanks for replying , i tried clearing the cache but no luck... The thing is if i run B.php on itself by hardcoding the $userid=34 . i am able to update
        Message 3 of 5 , Mar 30, 2008
        • 0 Attachment
          Hi,
               Thanks for replying , i tried clearing the cache but no luck... The thing is if i run B.php on itself by hardcoding the $userid=34 . i am able to update the combo boxes  using the onchange event. This is because i feel the onchange event is in the same script(B.php). But if a ajax call is made from A.html then the comboBoxes created in B.php show up with values but i am not able to update them.........

          Thanks 
          Ankit.




          On Mar 30, 2008, at 12:52 PM, Greg Skluzacek wrote:

          Sounds like the page may be cached... have you tried clearing the 
          browser's cache to see if that fixes the problem. If it does, then 
          try insering some headers in your a.html page that tell the browser 
          not to cache it. In php you would uses something like this... there 
          may be similiar meta tags to do this, but I'm not sure:

          header('Cache- Control: no-cache, must-revalidate' );
          header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');

          Regards,
          -- Greg

          --- In ydn-javascript@ yahoogroups. com, "ankitkhera" <kheraankit@ ...> 
          wrote:
          >
          > Hi 
          > I am making use of YUI ---> to make ajax call to my server side 
          script(php) it works fine 
          > but the events on the html(combo boxes etc) returned by server 
          script do not work below is 
          > the details description please help...
          > 
          > A.html makes a ajax call to B.php?userid= 123 passing userid as 
          querystring. Now B.php 
          > makes use of this userid and gets data from a dataSource like 
          mysql and then generates a 
          > html form .... with combo buttons , textboxes etc and sets them 
          with values got from data 
          > source. This response (html as string)is received by A.html page 
          by var response= 
          > o.responseText and then this value is displayed in A.html using 
          > document.getElement ById("resp" ).innerHTML = response, "resp" is a 
          <div id="resp"> where 
          > the server response is to be displayed; Now here begins the 
          problem if i change any value in 
          > the combo boxes which were generated by B.php(Server script) in 
          A.html(response data) the 
          > change is not reflected in dataSource.. ...because these boxes were 
          generated in B.php and 
          > the onchange event is also there ? How do i solve this problem
          > 
          > Thanks in Advance
          > Ankit.
          >


        • ankitkhera
          Hi, Thanks for replying , i tried clearing the cache but no luck... The thing is if i run B.php on itself by hardcoding the $userid=34 . i am able to update
          Message 4 of 5 , Mar 30, 2008
          • 0 Attachment
            Hi,
            Thanks for replying , i tried clearing the cache but no luck... The thing is if i run B.php
            on itself by hardcoding the $userid=34 . i am able to update the combo boxes using the
            onchange event. This is because i feel the onchange event is in the same script(B.php). But
            if a ajax call is made from A.html then the comboBoxes created in B.php show up with
            values but i am not able to update them.........

            Thanks
            Ankit.






            --- In ydn-javascript@yahoogroups.com, "Greg Skluzacek" <gskluzacek@...> wrote:
            >
            > Sounds like the page may be cached... have you tried clearing the
            > browser's cache to see if that fixes the problem. If it does, then
            > try insering some headers in your a.html page that tell the browser
            > not to cache it. In php you would uses something like this... there
            > may be similiar meta tags to do this, but I'm not sure:
            >
            > header('Cache-Control: no-cache, must-revalidate');
            > header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
            >
            > Regards,
            > -- Greg
            >
            > --- In ydn-javascript@yahoogroups.com, "ankitkhera" <kheraankit@>
            > wrote:
            > >
            > > Hi
            > > I am making use of YUI ---> to make ajax call to my server side
            > script(php) it works fine
            > > but the events on the html(combo boxes etc) returned by server
            > script do not work below is
            > > the details description please help...
            > >
            > > A.html makes a ajax call to B.php?userid=123 passing userid as
            > querystring. Now B.php
            > > makes use of this userid and gets data from a dataSource like
            > mysql and then generates a
            > > html form .... with combo buttons , textboxes etc and sets them
            > with values got from data
            > > source. This response (html as string)is received by A.html page
            > by var response=
            > > o.responseText and then this value is displayed in A.html using
            > > document.getElementById("resp").innerHTML = response, "resp" is a
            > <div id="resp"> where
            > > the server response is to be displayed; Now here begins the
            > problem if i change any value in
            > > the combo boxes which were generated by B.php(Server script) in
            > A.html(response data) the
            > > change is not reflected in dataSource.....because these boxes were
            > generated in B.php and
            > > the onchange event is also there ? How do i solve this problem
            > >
            > > Thanks in Advance
            > > Ankit.
            > >
            >
          • bretlevy
            Ankit: If I follow you correctly, you are inserting a complete HTML form snippet into your existing dispayed page. This is fine, but YUI will have no idea
            Message 5 of 5 , Mar 31, 2008
            • 0 Attachment
              Ankit:

              If I follow you correctly, you are "inserting" a complete HTML form
              snippet into your existing dispayed page. This is fine, but YUI will
              have no idea that those controls (from the inserted html) are there.
              So if you have a listener on an id, such as "myDropDown1" and that
              element is in the inserted html, YUI will not (probably) "hook up" to
              it. When you do an addListener or "on" hook request, YUI tries for a
              short time to make the connection. If it can't, I think it just
              gives up! So an element id that is loaded "after the fact" via an
              xhr request typically will not get seen by your init code (assuming
              you hook onDOMReady or on load).

              However, the browser's DOM will "see" these objects and elements
              after they are inserted. I do exactly what you describe all the
              time, but I have to use html hooks to react to changes, etc. So if
              you have a dropdown list you want to handle changes with, you have to
              insert code like:

              <select onchange="myHandler(this)">...</select>

              for example. Then your local page's myHandler() routine will get
              called. That routine can be in A.html. My example passes in the
              select object as "this" so that you can do something like this:

              function myHandler (oList) {
              var ndx = oList.selectedIndex;
              var val = oList.options[ndx].value;
              :
              :
              }

              Hope that helps,

              ~~bret


              --- In ydn-javascript@yahoogroups.com, Ankit Khera <kheraankit@...>
              wrote:
              >
              > Hi,
              > Thanks for replying , i tried clearing the cache but no
              luck...
              > The thing is if i run B.php on itself by hardcoding the
              $userid=34 . i
              > am able to update the combo boxes using the onchange event. This
              is
              > because i feel the onchange event is in the same script(B.php). But
              if
              > a ajax call is made from A.html then the comboBoxes created in
              B.php
              > show up with values but i am not able to update them.........
              >
              > Thanks
              > Ankit.
              >
              >
              >
              >
              > On Mar 30, 2008, at 12:52 PM, Greg Skluzacek wrote:
              >
              > > Sounds like the page may be cached... have you tried clearing the
              > > browser's cache to see if that fixes the problem. If it does, then
              > > try insering some headers in your a.html page that tell the
              browser
              > > not to cache it. In php you would uses something like this...
              there
              > > may be similiar meta tags to do this, but I'm not sure:
              > >
              > > header('Cache-Control: no-cache, must-revalidate');
              > > header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
              > >
              > > Regards,
              > > -- Greg
              > >
              > > --- In ydn-javascript@yahoogroups.com, "ankitkhera" <kheraankit@>
              > > wrote:
              > > >
              > > > Hi
              > > > I am making use of YUI ---> to make ajax call to my server side
              > > script(php) it works fine
              > > > but the events on the html(combo boxes etc) returned by server
              > > script do not work below is
              > > > the details description please help...
              > > >
              > > > A.html makes a ajax call to B.php?userid=123 passing userid as
              > > querystring. Now B.php
              > > > makes use of this userid and gets data from a dataSource like
              > > mysql and then generates a
              > > > html form .... with combo buttons , textboxes etc and sets them
              > > with values got from data
              > > > source. This response (html as string)is received by A.html page
              > > by var response=
              > > > o.responseText and then this value is displayed in A.html using
              > > > document.getElementById("resp").innerHTML = response, "resp" is
              a
              > > <div id="resp"> where
              > > > the server response is to be displayed; Now here begins the
              > > problem if i change any value in
              > > > the combo boxes which were generated by B.php(Server script) in
              > > A.html(response data) the
              > > > change is not reflected in dataSource.....because these boxes
              were
              > > generated in B.php and
              > > > the onchange event is also there ? How do i solve this problem
              > > >
              > > > Thanks in Advance
              > > > Ankit.
              > > >
              > >
              > >
              > >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.