Not getting data if user doesn't exist

I am trying to check to see if a user account exists and i would like to output a default text if the user does not have an account or if their account is closed. For some reason the code below does not log anything to the console even though it should log “undefined”? Am i doing something wrong? Why won’t this work?

$.getJSON('’, function(data){

Which browser and version of jQuery are you using? I threw your code into a simple page, and I get the error object logged to the console. The Twitch API always returns a 200 with an object that contains the error.

@DallasNChains Are you sure about that? The API is returning HTTP status 422 for my XHRs to unprocessable users. Difference between CORS and JSONP?

Some how i seemed to have corrupted my jquery library. I just reloaded jquery and bam, works like a charm. Thanks for the reminder that its best to test these things in a browser prior to reaching out for help. Thanks

1 Like

@3ventic JSONP will always return 200 status. CORS should return the correct HTTP status. The docs mention the JSONP difference under “Errors” here:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.