Home Forum Software Fiddle API example not working

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #4433
    Mads Barnkob
    Moderator

    Hi All

    I tried out the Fiddle API example ( https://jsfiddle.net/gsgfna61/5/ ) and put in my ID and userkey

    var userid = “204”; // set a valid user id from the uRADMonitor Dashboard!
    var userkey= “8cc846e55e322e4dc69aaa36522e188f”;

    But it does not load any units

    #4436
    uRADMonitor
    Keymaster

    Apparently if works in Safari right away, while Chrome says “Failed to load resource: net::ERR_INSECURE_RESPONSE” and the code only shows the purple “Loading”.

    “Your resource probably use a self-signed SSL certificate over HTTPS protocol. Chromium, so Google Chrome block by default this kind of resource considered unsecure. ”

    You can bypass this this way :

    Assuming your frame’s URL is https://www.domain.com, open a new tab in chrome and go to https://www.domain.com.
    Chrome will ask you to accept the SSL certificate. Accept it.
    Then, if you reload your page with your frame, you could see that now it works
    The problem as you can guess, is that each visitor of your website has to do this task to access your frame.

    You can notice that chrome will block your URL for each navigation session, while chrome can memorise for ever that you trust this domain.

    This problem will be fixed in a more elegant way, as soon as the entire site moves to HTTPS, soon.

    LE: if you can use the code , changing the HTTPS to HTTP in the api calls in the javascript code (not on JSFiddle), then it will work as well.

    #4455
    Mads Barnkob
    Moderator

    I was using Chrome.

    I can confirm that Fiddle works straight out of the box in MSIE, but not when the code is ran from my own website: http://kaizerpowerelectronics.dk/everyday-science/radiation-monitoring/ no matter if its http/https in the code, and my domain seems to redirect all to http, if I try https.

    #4456
    uRADMonitor
    Keymaster

    The code runs with errors:
    [Error] TypeError: $ is not a function. (In ‘$(“#status”)’, ‘$’ is undefined)
    downloadUnits (radiation-monitoring:325)
    Global Code (radiation-monitoring:424)

    You will need to add JQuery too, it is also in JSFiddle, top-left of the screen. But easier, here is what you need to add to the blog’s headers:

      	<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
      	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
      	<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    	<script src="http://cdnjs.cloudflare.com/ajax/libs/dygraph/1.1.1/dygraph-combined.js"></script>
    #4457
    Mads Barnkob
    Moderator

    This was only my 2nd time using Fiddle, so I completely missed there was a external references tab 🙂

    I can get it to fetch the data, but not draw it, on my own site ( http://kaizerpowerelectronics.dk/everyday-science/radiation-monitoring/ )

    The same terrible hacked up code works in Fiddle ( https://jsfiddle.net/pzr8efr8/ )

    I will take a look at it later when you say the backend is ready 🙂

    #4745
    Mads Barnkob
    Moderator

    Directly copied from fiddle and runs outside of wordpress, its the same problem :/

    http://kaizerpowerelectronics.dk/test/urad.html

    #4756
    uRADMonitor
    Keymaster

    Hi Mads,

    You can use the “Inspect element” / “Inspect” to get info on what happens on various web pages. This shows there’s an error in the code, see the pic attached.

    Apparently, you called the Javascript that does download and chart BEFORE the html code initialised the code for the chart DIV. Please do the javascript after.

    Let me know if this helps,

    #4817
    Mads Barnkob
    Moderator

    You are absolutely right!

    I just stopped thinking and put all the javascript in the top 😮

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.