problem with ajax call(jquery)

42 views
Skip to first unread message

robin geldolf

unread,
Jul 15, 2014, 5:20:02 PM7/15/14
to wallabee-...@googlegroups.com
$.ajax({
    type: 'GET',
    dataType: "json",

    url: 'http://api.wallab.ee/achievements',
    headers: {
        "X-WallaBee-API-Key":"xxxxx"
},
    xhrFields: {
        withCredentials: true
    },

    success: function(data) {
        console.log('success');
    },
    error: function(data) {
        console.log("failure");
    }
});
I'm trying to connect with the api using the above jquery ajax request, but i am unable to retrieve a success.
I'm connecting from localhost, i thought the api was cors enabled, i am probably doing something wrong, can someone help ?
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8888' is therefore not allowed access. 
greatz.
Robin

Ben Dodson

unread,
Jul 16, 2014, 5:51:04 AM7/16/14
to wallabee-...@googlegroups.com
Hey Robin,

The API wasn't CORS enabled but it is now. Enjoy!

Ben
> --
> You received this message because you are subscribed to the Google Groups "WallaBee Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wallabee-develo...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

robin geldolf

unread,
Jul 16, 2014, 7:04:00 AM7/16/14
to wallabee-...@googlegroups.com

I'm still getting the same message.

XMLHttpRequest cannot load http://api.wallab.ee/achievements. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8888' is therefore not allowed access. 



I thought is was cors enabled after reading the "Enable CORS/JSONP?" topic from Bramus.

Op dinsdag 15 juli 2014 23:20:02 UTC+2 schreef robin geldolf:

Ben Dodson

unread,
Jul 16, 2014, 7:14:33 AM7/16/14
to wallabee-...@googlegroups.com
I'm using that exact code (with a valid API key) from my localhost and everything is working fine.
Message has been deleted

Maarten Van Breuseghem

unread,
Aug 4, 2014, 6:34:22 AM8/4/14
to wallabee-...@googlegroups.com
I'm still getting the same error as Robin.
I'm trying to do a ajax call from my localhost and getting following error
XMLHttpRequest cannot load http://api.wallab.ee/itemreleases. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.

Can you please add this header?  

Ben Dodson

unread,
Aug 10, 2014, 5:06:18 AM8/10/14
to wallabee-...@googlegroups.com
Hey Maarten,

The endpoints are definitely returning "Access-Control-Allow-Origin: *" and I've had an email from Robin confirming that it is working at his end.

If you could email your code to me at b...@wallab.ee then I can take a look on my localhost and see if I can isolate the issue.

Regards,

Ben


--
Ben Dodson,
iOS Developer

www.bendodson.com | b...@bendodson.com

Ben Dodson Apps Ltd
The Bristol Office, 2nd Floor, 5 High Street, Westbury on Trym, Bristol, England, BS9 3BY
Company Number: 07856552

I'm also CEO of WallaBee, the largest collectibles game on iOS and winner of "Best European Gaming Startup 2012". Check it out at http://wallab.ee/





On 4 Aug 2014, at 11:33, Maarten Van Breuseghem <maarten.van...@gmail.com> wrote:

> I'm still getting the same error as Robin.
> I'm trying to do a ajax call from my localhost and getting following error
> XMLHttpRequest cannot load http://api.wallab.ee/itemreleases. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
>
> Can you please add this header?
>
> Op woensdag 16 juli 2014 13:14:33 UTC+2 schreef Ben Dodson:

Staffan Wennberg

unread,
Nov 4, 2014, 6:01:46 PM11/4/14
to wallabee-...@googlegroups.com
@Ben

Has anything changed since this latest answer? I'm having the exact same response. My call looks more or less identical to the one posted by robin on top of this thread. I'm getting an initial OPTIONS request with status 200, complaining about the Access-Control-Allow-Origin. And then no GET request, accordingly.

Regards,
stafffan

Ben Dodson

unread,
Nov 5, 2014, 2:52:03 AM11/5/14
to wallabee-...@googlegroups.com
If you send an example of your code to me at b...@wallab.ee then I’ll take a look.

Ben



Reply all
Reply to author
Forward
0 new messages