Solved

java script to redirect to a new page

Posted on 2013-11-25
12
633 Views
Last Modified: 2014-01-02
I want to write an application to book a tennis court 5 at 6pm on every Wednesday .  Using the following script  I can logon to the membership page successfully, but how can I redirect to booking page,  Wednesday booking page and book the court 5 ?
thanks


   
<!doctype html>
    <html>
    <title>Tennis Sport Club Autologin</title>
    
    <body>

<form id="loginbox" action="https://engine.gigasports.com/VerifyLogin.asp" method="post" name="Logon">
    <select name="uni_url" id="logServer" class="validate[required]">
     </select>  
           
                Username <input type="text" size="12" name="txtUserID" id="txtUserID" value="username" >
                Password <input type="password" size="12" name="txtPassword" id="txtPassword" value="passowrd">
                <br />he
 </form>

  <script>document.forms['Logon'].submit();</script>      

 <script language="javascript" type="text/javascript">
      
     window.location.href="http://engine.gigasports.com/Booking.asp";
     
 </script>
          

  </body></html>

Open in new window

booking.jpg
logon.jpg
booking.txt
logon.txt
0
Comment
Question by:HemlockPrinters
12 Comments
 
LVL 30

Assisted Solution

by:Alexandre Simões
Alexandre Simões earned 250 total points
ID: 39676878
This is best done with a browser automation tool like Selenium

Selenium also support to be launched from command line so you can set it as a windows task to be run everyday at a certain hour...
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 250 total points
ID: 39676941
As per my understanding login page redirectling you to the VerifyLogin.asp
then you need to put javascript on VerifyLogin.asp page to redirect to boooking page

     
     window.location.href="http://engine.gigasports.com/Booking.asp";
0
 

Author Comment

by:HemlockPrinters
ID: 39685857
thanks. Login page redirected me to the verifylogin.asp.  How do I put java script on VerifyLogin.asp page?
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39686457
As per your last comment you could put javascript on any page by using <script> tag.

 <script language="javascript" type="text/javascript">
 
    window.location.href="http://engine.gigasports.com/Booking.asp";
     
 </script>
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:HemlockPrinters
ID: 39690481
thanks insoftservice, I put javascript after submit the login form, but it doesn't open the booking page though.

---------------------------------------



<!doctype html>
    <html>
    <title>Tennis Sport Club Autologin</title>
   
    <body>

<form id="loginbox" action="https://engine.gigasports.com/VerifyLogin.asp" method="post" name="Logon">
    <select name="uni_url" id="logServer" class="validate[required]">
     </select>  
           
                Username <input type="text" size="12" name="txtUserID" id="txtUserID" value="username" >
                Password <input type="password" size="12" name="txtPassword" id="txtPassword" value="passowrd">
                <br />he
 </form>

  <script>document.forms['Logon'].submit();</script>      

 <script language="javascript" type="text/javascript">
     
     window.location.href="http://engine.gigasports.com/Booking.asp";
     
 </script>
         

  </body></html>
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39692386
"Your session has expired.
Please log in again"

Are you getting that page.If yes then please pass on the session and parameters required for these page.
Stop the page before redirecting it to  "http://engine.gigasports.com/Security_SessionExpired.asp" so that it would be clear that you page has been redirected.
And to keep it on we have to pass the required data
0
 

Author Comment

by:HemlockPrinters
ID: 39696936
thanks Infoftservice, I got what you mean. but how to pass on the required session variables?
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39697483
For such cases you have to take help of AJAX using some scripting language and then send such secure data using REST method like curl ,socket e.t.c
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 39751026
@Rob (tagit) how come my comments were not accepted . please check my all comments so as to get proper idea that client was able to redirect his page but later he got stuck in session which even i had suggested the way.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now