calling html file from javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raknin
    New Member
    • Oct 2007
    • 82

    calling html file from javascript

    Hi,

    Is there any way to call html file from a javascript.

    What I want to do is as following:

    1) send information to sever and checkit by using Javascript.
    2) if everything is OK. call another html file inside the same javascript.

    How it can be done.
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    hi ...

    please explain a little bit more what you mean with:

    ' ... call another html file inside the same javascript ... '

    kind regards

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      Originally posted by raknin
      Hi,

      Is there any way to call html file from a javascript.

      What I want to do is as following:

      1) send information to sever and checkit by using Javascript.
      2) if everything is OK. call another html file inside the same javascript.

      How it can be done.
      Is it something like Google's login?

      Comment

      • vee10
        New Member
        • Oct 2006
        • 141

        #4
        Hi ,

        u can call another html file by using window.navigate ("htmlfile.html ") in javascript


        Originally posted by raknin
        Hi,

        Is there any way to call html file from a javascript.

        What I want to do is as following:

        1) send information to sever and checkit by using Javascript.
        2) if everything is OK. call another html file inside the same javascript.

        How it can be done.

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5388

          #5
          Originally posted by vee10
          Hi ,

          u can call another html file by using window.navigate ("htmlfile.html ") in javascript
          that is certainly IE only and so it is not standards-compliant - i woudn't recommend that method unless you are sure to code for IE only (may be an intranet-solution) ... but to solve the problem we first have to know exactly what the requirement is ...

          kind regards

          Comment

          • raknin
            New Member
            • Oct 2007
            • 82

            #6
            The situation is:

            I want to move from one html file to another and stay in the same window.

            The process that I am going through is as following:

            I am submitting the result of the page throgh javascript to the server using AJAX and PHP.
            if everthing is fine I want to load a second html page instead of the current one.

            I think this is clear

            Comment

            • gits
              Recognized Expert Moderator Expert
              • May 2007
              • 5388

              #7
              then let your server send an ok or an url and set the location.href of the window ... alternativly you could send the html and replace the innerHTML of the documents body ...

              kind regards

              Comment

              • raknin
                New Member
                • Oct 2007
                • 82

                #8
                Originally posted by gits
                then let your server send an ok or an url and set the location.href of the window ... alternativly you could send the html and replace the innerHTML of the documents body ...

                kind regards
                Unfortunately the location.href is not working maybe I don't use it correctly I am using window.location .("http://www.xx.com/xxx.htm") but nothing happen I not taken to the new page I check it on IE and FF.

                I check it with the document body and it doesn't work for me.

                Thanks anyway

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5388

                  #9
                  try this:

                  [CODE=javascript]window.location .href = "http://www.xx.com/xxx.htm";[/CODE]
                  kind regards

                  ps: note that this loads a new page and breaks out of the 'ajax-paradigm' to reload content in the background ...

                  Comment

                  • raknin
                    New Member
                    • Oct 2007
                    • 82

                    #10
                    Originally posted by gits
                    try this:

                    [CODE=javascript]window.location .href = "http://www.xx.com/xxx.htm";[/CODE]
                    kind regards

                    ps: note that this loads a new page and breaks out of the 'ajax-paradigm' to reload content in the background ...
                    Gits,
                    Thanks this is exactly what I was looking for I will try it and let you know

                    Comment

                    • gits
                      Recognized Expert Moderator Expert
                      • May 2007
                      • 5388

                      #11
                      no problem :) ... post back when there are problems with it ...

                      kind regards

                      Comment

                      • raknin
                        New Member
                        • Oct 2007
                        • 82

                        #12
                        Thanks gits it is working perfect.

                        Comment

                        Working...