Home forums Using CanvasJS getJSON issue

Tagged: 

This topic contains 7 replies, has 3 voices, and was last updated by  Vishwas R 2 months, 3 weeks ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #19932

    Meric
    Member

    Hi there,
    I’m in pain with a getJSON.

    I tried to run this example at home… without success. blank page.
    I serve it from my server, and serve the JSON myself… same issue, blank page.
    I tried with this tuto, and it works perfectly, so the jquery is correctly running…

    I apology for this probably stupid newbie question, but I’m going crazy, and I request for your help.
    Thanks for this cool lib.

    Méric

    • This topic was modified 9 months ago by  Meric.
    #19935

    Meric
    Member

    OK, going to be resolved : Seems to be an Access-Control-Allow-Origin.

    #19936

    Meric
    Member

    … Access control resolved… but page still blank :’-(

    What am I doing wrong ?

    #19938

    Meric
    Member

    (cannot edit or delete my post, so I post again)
    I try this Sunil tip, always blank.

    #19939

    Vishwas R
    Keymaster

    @meric,

    For security reasons, browsers restrict cross-origin requests. Serving JSON file from local webserver and making an AJAX call to it or serving it from CORS enabled JSON hosting service like myjson.com should work fine. Please take a look at this jsfiddle.

    Also can you please check the Browser Console if there are any errors. Also kindly create jsfiddle reproducing the issue so that we can look into it and help you out.


    Vishwas R
    Team CanvasJS

    #19941

    Meric
    Member

    Understood.
    I assumed that my stuff to resolve the Access-Control-Allow-Origin message error bypass this issue, but I misunderstood.

    It works, thanks a lot.
    Have a nice day, Vishwas.

    Méric.

    • This reply was modified 9 months ago by  Meric.
    #22639

    wonky
    Member

    Hey all,

    Thanks to the support guy for that suggestion, but it looks kind of like bit.ly-ing a URL, a two step process.

    Is there any reason not to use something like this ? It’s a clean one step solution with as little as two additional lines of code, maybe 5 if you include the comments.

    The PHP Bitcoin example which had the CORS problem worked immediately after I added this.

    Thanks in advance!

    #22646

    Vishwas R
    Keymaster

    @wonky,

    Thanks for sharing the article, which would help others who are facing this issue. You can use the reverse proxy / spoofing mentioned in the article if it’s secure to use.


    Vishwas R
    Team CanvasJS

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.