Hi,
How did you generate apiKey? Are you sure that key is still valid? If you know the answer to these questions, half of the problem is solved.
When you send the authentication details, you have to send it as part of the Request Header, not as data. From the code you provided I assume you are using basic authentication.
But, do you know that these credentials can easily be compromised? Because these are base64 encoded not encrypted. Do take that into consideration when you choose a authentication method.
Here are some articles that show how to send the authentication details in request header.
http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax[
^]
http://blog.tompawlak.org/basic-authentication-jquery-ajax[
^]
http://laravel.io/forum/12-11-2014-basic-auth-api-jquery-cors[
^]
Try these and see if it works.