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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Posting info from Javascript API

    Hi everyone!

    Firstly, im a beginner in Javascript, totally noobie. Much why this is posted!

    I have found this site:
    http://www.forswor.com/index.php/data-apis/

    And I want to use this to post the server status on my forum/website.

    How exactly do I do that?
    I know there are examples and such and I have read and read on that page but I cannot figure out how to do this.

    I cant just paste:
    <script type="text/javascript" src="http://www.forswor.com/forswor_services/prod/serverwidget/getSWTORStatusjs.php"> </script>

    How would I get this to show the information of say for example Bloodworthy server and in text?
    I tried adding the line document.write(forswor_server_name);, but didnt show up anything - stupid as I am obviously I have no clue what im doing.
    I can manage html\css and some php but this is new for me, hehe.

    Thank you so much for reading an idiots post!
    Most regards, me.
    Last edited by Ninetail; 03-15-2012 at 06:41 PM.

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    974
    Thanks
    19
    Thanked 212 Times in 210 Posts
    Code:
    <html>
    <head>
    <title>Colour Changer</title>
    <script type="text/javascript" src="http://www.forswor.com/forswor_services/prod/serverwidget/getSWTORStatusjs.php"> 
    </script>
    <script>alert(forswor_server_state)</script>
    </head>
    <body>
    
    </body>
    </html>
    Code:
    <html>
    <head>
    <title>Colour Changer</title>
    <script type="text/javascript" src="http://www.forswor.com/forswor_services/prod/serverwidget/getSWTORStatusjs.php"> 
    </script>
    
    </head>
    <body>
    <script>
    document.write("forswor_server_state = ");
    document.write(forswor_server_state);
    </script>
    </body>
    </html>
    Last edited by DaveyErwin; 03-15-2012 at 07:03 PM.

  • #3
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey thanks alot! Really appreciate it!

    <html>
    <head>
    <script type="text/javascript" src="http://www.forswor.com/forswor_services/prod/serverwidget/getSWTORStatusjs.php?server=Bloodworthy">
    </script>

    </head>
    <body>
    <script>
    document.write("Server: ");
    document.write(forswor_server_name);
    document.write("Server status: ");
    document.write(forswor_server_state);
    document.write("Server load: ");
    document.write(forswor_server_load_txt);
    </script>
    </body>
    </html>

    I have two more questions.

    1. How do I make a new line? like <br>
    I couldnt make <br> <br \> or \n to work.

    2. How do I make an image to appear if forswor_server_state turns out UP?
    One image for UP and one for DOWN. I imagine if else to be involved.

    Example images:
    http://www.forswor.com/forswor_servi.../images/up.png
    http://www.forswor.com/forswor_servi...mages/down.png

    Thank you!
    Last edited by Ninetail; 03-15-2012 at 11:55 PM.


  •  

    Posting Permissions

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