0

I want to get data from an api. Output to text for now. The api does not accept standard authentication the headers must contain 2 fields username=12345 password=12345 Can someone post a simple javascript to do this?

user1637477
  • 169
  • 1
  • 1
  • 9
  • 2
    Here is a [getting started guide](https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started) on Ajax. – Christofer Eliasson Mar 19 '13 at 07:05
  • @ChristoferEliasson where in that guide is mentioned how to set userID and password on an ajax request? – mplungjan Mar 19 '13 at 07:08
  • possible duplicate of [How to use Basic Auth and Jquery and Ajax](http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax) which was EASILY found googling for `userid password ajax` – mplungjan Mar 19 '13 at 07:09
  • 1
    @mplungjan It is not mentioned explicitly, but Step 1 explain how to set the headers - adopting that to this case would give something like `httpRequest.setRequestHeader('username', '12345');` – Christofer Eliasson Mar 19 '13 at 07:11
  • Ah - right. missed that. Was looking for auth. – mplungjan Mar 19 '13 at 07:23

0 Answers0