Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [HELP] Which language to use?

    I started to learn Javascript but then wasn't sure if it was what i wanted.

    I need to create a script that can execute certain commands on a web page. It would make my general job alot easier. But how would i go about doing this? I've been searching the net for answers but cant really find any good solutions. The site which i need to run the script on is not mine.

    The type of script i will need to run will be like this:

    If <Something comes up>
    Execute a certain command.

    I work as a travel agent and on alot of nights i have to stay up all night waiting for the seats to be booked on the site. So i need the program to check every few seconds until the seats are booked. When this is done i need it to book them on my end.


    Thanks for any help

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,800
    Thanks
    6
    Thanked 1,023 Times in 996 Posts
    Sounds like a cron job. In any case, it’s nothing JS can or ahould do. The bookings probably get stored in a database of some kind, right? So you need to create a server-side script (PHP/JSP/Perl/ASP.NET/…) that checks for bookings and sends out an e-mail, for example. And then you let the cron job execute that script on a regular basis.

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,174
    Thanks
    203
    Thanked 2,549 Times in 2,527 Posts
    Quote Originally Posted by n3Kite View Post
    The site which i need to run the script on is not mine.
    JavaScript can *NOT* access any pages that come from a different domain than the domain where the JS code originated. This is called the Same Origin Policy.

    JavaScript SOP automatically prevents scripts on one server from accessing properties of documents on a different server. Simply stated, the SOP states that JavaScript code running on a web page may not interact with any resource not originating from the same web site.

    You will need to use server-side scripting (PHP etc.)

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #4
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    Sounds like a cron job. In any case, it’s nothing JS can or ahould do. The bookings probably get stored in a database of some kind, right? So you need to create a server-side script (PHP/JSP/Perl/ASP.NET/…) that checks for bookings and sends out an e-mail, for example. And then you let the cron job execute that script on a regular basis.
    Which would you reccommend?

  • #5
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    Sounds like a cron job. In any case, it’s nothing JS can or ahould do. The bookings probably get stored in a database of some kind, right? So you need to create a server-side script (PHP/JSP/Perl/ASP.NET/…) that checks for bookings and sends out an e-mail, for example. And then you let the cron job execute that script on a regular basis.
    Quote Originally Posted by Philip M View Post
    JavaScript can *NOT* access any pages that come from a different domain than the domain where the JS code originated. This is called the Same Origin Policy.

    JavaScript SOP automatically prevents scripts on one server from accessing properties of documents on a different server. Simply stated, the SOP states that JavaScript code running on a web page may not interact with any resource not originating from the same web site.

    You will need to use server-side scripting (PHP etc.)

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    Would PHP be the best option?

  • #6
    New Coder donna1's Avatar
    Join Date
    Nov 2012
    Location
    london
    Posts
    99
    Thanks
    9
    Thanked 4 Times in 4 Posts
    I disagree in part, with the above replies
    I think Javascript can regularly view the site for you using iframe, then alert you when it's changed.
    Would have a go if you tell me which is the website that needs to be checked

  • #7
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,339
    Thanks
    29
    Thanked 283 Times in 277 Posts
    Quote Originally Posted by n3Kite View Post
    I work as a travel agent and on alot of nights i have to stay up all night waiting for the seats to be booked on the site. So i need the program to check every few seconds until the seats are booked. When this is done i need it to book them on my end.
    It's possible this can be done with a UserScript-based add-on such as Greasemonkey. UserScripts are just JavaScript with some comment headers.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •