Refresh page problem using AJAX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • preetksaini
    New Member
    • Mar 2007
    • 19

    Refresh page problem using AJAX

    hi
    i am having a page in which i have 3 dropdowns,value s of 2nd dropdown comes based on 1st and values of 3rd dropdown come based on 2nd.using AJAX+PHP to load dropdowns.

    but whenever i refresh the page the selection and values of dropdown are lost.
    can anyone help me how to maintain the selected values of dropdown on page refresh (to maintain webpage state).


    thnx.
  • preetksaini
    New Member
    • Mar 2007
    • 19

    #2
    Refresh page problem using AJAX

    hi
    i am having a page in which i have 3 dropdowns,value s of 2nd dropdown comes based on 1st and values of 3rd dropdown come based on 2nd.using AJAX+PHP to load dropdowns.

    but whenever i refresh the page the selection and values of dropdown are lost.
    can anyone help me how to maintain the selected values of dropdown on page refresh (to maintain webpage state).


    thnx.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      But the whole point/reason of using the Ajax technique is NOT to have the page refreshed!

      When you still want to do that, you'll have to take precautions by preserving the selected box'es values, and setting the already clicked dropdown options to 'selected=selec ted'.

      Ronald :cool:

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Merged and split threads.

        Comment

        • preetksaini
          New Member
          • Mar 2007
          • 19

          #5
          on dat page im having a button which when clicked opens a pop and some data is entered in dat pop up window,when pop window is closed the data dat is entered is to be reflected in one of the dropdowns in the page.

          so onclose event of pop up window i refresh d parent window for d same.

          but on refresh i loose the dropdown from page which i have created using ajax.

          thnx

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            You don't need to refresh the page for that. Just use
            Code:
            window.opener
            to access the opening window. Once you've set the dropdown, close the popup.

            Comment

            • preetksaini
              New Member
              • Mar 2007
              • 19

              #7
              hi

              thnx for reply.

              but problem is not opening the pop window,problem is to retain the dropdown boxes after the pop window is closed and the parent gets refreshed,i loose all the dropdowns created using AJAX and their selected values.

              thnx

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                I think you've misunderstood my reply. See this page. You can use 'window.opener' to reference the parent window. Once you have that ref. you can manipulate the dropdowns.

                Comment

                • preetksaini
                  New Member
                  • Mar 2007
                  • 19

                  #9
                  Originally posted by acoder
                  I think you've misunderstood my reply. See this page. You can use 'window.opener' to reference the parent window. Once you have that ref. you can manipulate the dropdowns.

                  thnx it worked for me

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    No problem. You're welcome.

                    Comment

                    Working...