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

    Post Code for updating live stats to a website

    Hi everyone.

    This is my first post, and I'm basically wondering if any of you can help we with some stuff.

    I've created the bare bones of a website in HTML, and I think, I need a JavaScript to achieve my aim.

    I need to take a value from this website: http://Cryptocoinexplorer.com:5750/q, and have it update automatically in my HTML website. I want the getdifficulty API to update on my site as often as it actually updates in real time.

    If anyone could help me write some code to have this show up on my site that would be amazing! I would spend time learning JavaScript myself, but I'm on a very limited timescale at the moment, and I need to have it figured out soon.
    Thanks guys
    -Knoxville

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Not in just JS; same-site policy. Unless your site is hosted on Cryptocoinexplorer.com.

    Server-side can at least get the data. Real-time updating, however, might be a bit more tricky.. esp for a beginner.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    This forum is not a free coding service. As a general rule, the people helping out in this forum don't write code for others, but try to help with fixing code that doesn't work. You'll be far more likely to get help if you have made a substantial effort and written some code yourself. Then someone here will almost certainly help you correct/improve your work.

    But in any case you will need server-side coding to accomplish this. For security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    Last edited by Philip M; 04-22-2013 at 04:37 PM.

    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
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,371
    Thanks
    11
    Thanked 591 Times in 572 Posts
    these days, most APIs have JSONp flavors, which you can fetch from any site. If you have an old-school XML-only API, then you need a server or to use a free server service like YQL or yahoo pipes to fetch the data and deliver it to your site as jsonp.

    i didn't see any api docs, other than a skeleton listing. since i couldn't even figure out the param format, i couldn't test the json features, if there even are any...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #5
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    This forum is not a free coding service. As a general rule, the people helping out in this forum don't write code for others, but try to help with fixing code that doesn't work. You'll be far more likely to get help if you have made a substantial effort and written some code yourself. Then someone here will almost certainly help you correct/improve your work.

    But in any case you will need server-side coding to accomplish this. For security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    My apologies for coming across like I wanted all the work done for me. That's not what I meant. I should have asked if anyone could point me in the right direction in getting started instead.

    Anyway, thanks for the information guys. So I can't use JavaScript. I mean, it's not the biggest issue in the world. I can always just change the difficulty manually every couple of days. Thanks for your help anyway

    Mods can delete this if they want, as it's probably not very helpful to anyone.

  • #6
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Look up RSS feeds.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #7
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,980
    Thanks
    56
    Thanked 557 Times in 554 Posts
    Either way (I think - and am quite open to correction here) javascript can't tell you when the updates happen on another page.

    If that's correct, you would have to be polling for changes at certain intervals anyway, which may actually simplify the whole task somewhat.

  • #8
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Quote Originally Posted by xelawho View Post
    Either way (I think - and am quite open to correction here) javascript can't tell you when the updates happen on another page.

    If that's correct, you would have to be polling for changes at certain intervals anyway, which may actually simplify the whole task somewhat.
    Yeah.. even if only updating once a day (or as you typed, every couple of days), a server-side solution with polling would be effective enough.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #9
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,371
    Thanks
    11
    Thanked 591 Times in 572 Posts
    Quote Originally Posted by xelawho View Post
    Either way (I think - and am quite open to correction here) javascript can't tell you when the updates happen on another page.
    it can as much as anything else can, front or back end.


    polling is one way to do it, tried and true, but there are even better methods out there now. if websockets is overkill, webRTC is an atomic bomb, but eventSource is based on http and is very simple to implement.

    you can phone home to a server at any point, it's the server phoning you that's difficult, and that's what eventSource does and does well.

    most libs that offer real-time will use a stack of technologies to deliver an abstract IO pattern that works great on new machines and decently on old machines.

    there will be some delay in these connections, but 40 round-trips a second is possible on good machines. with older browsers, you might see about 5-10 round trips / second on a good day...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%


  •  

    LinkBacks (?)


    Posting Permissions

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