Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
88 lines (67 sloc) 2.48 KB
<!doctype html>
<title>Your EVE Data</title>
<meta charset="utf-8">
<script src="//"></script>
<script type="text/javascript">
EVE Online
Sample API request
by Michael Moehler -
// you probably want to make more than one request
var api_baseurl = '';
var api_keyID;
var api_vCode;
// load character data from api
function fetch_chars(){
var placeholder = $('#chars'); // where to place all the gathered stuff
api_keyID = $('#keyID').val(); // get the Key ID
api_vCode = $('#vCode').val(); // get the Verification Code
// ajax request
url : api_baseurl+'/account/Characters.xml.aspx', // we want character information
crossDomain : true, // yep - that's a cross domain request
dataType : 'xml', // we want XML data (eve won't give us something else)
data : { // the api data
'keyID' : api_keyID,
'vCode' : api_vCode
// what to do when something goes wrong
error: function() {
placeholder.text("Could not get character data - please check Key ID and Verification Code.");
// what to do if the request succeeded
var list = $('<ul>'); // prepare a list
$(data).find( "row" ).each(function(){ // process each character
var chararcter = $('<li>',{ // create a new entry
text : $(this).attr('name') // text will be the character name
list.append(chararcter); // add it to the list
placeholder.html(list); // add list to placeholder
// on document ready
$('#api-data button').click(function(e){
fetch_chars(); // fetch
e.preventDefault(); // don't submit
<h1>EVE Datacenter</h1>
<form id="api-data">
<input id="keyID" type="text" placeholder="Key ID">
<input id="vCode" type="text" placeholder="Verification Code">
<button>Fetch Characters</button>
<div id="chars"></div>
<div id="char-data"></div>