commit
188b43eda4
2 changed files with 41 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<header> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge"> |
||||||
|
<script src="js/main.js" defer></script> |
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> |
||||||
|
</header> |
||||||
|
<body> |
||||||
|
|
||||||
|
</body> |
@ -0,0 +1,30 @@ |
|||||||
|
'use strict' |
||||||
|
function createAgent(faction, symbol){ |
||||||
|
const data = {faction: faction, symbol: symbol} |
||||||
|
const settings = { |
||||||
|
async: true, |
||||||
|
crossDomain: true, |
||||||
|
url: 'https://api.spacetraders.io/v2/register', |
||||||
|
method: 'POST', |
||||||
|
headers: { |
||||||
|
'Content-Type': 'application/json', |
||||||
|
'Accept': 'application/json' |
||||||
|
}, |
||||||
|
processData: false, |
||||||
|
data: data |
||||||
|
}; |
||||||
|
|
||||||
|
$.ajax(settings).done(function (response) { |
||||||
|
console.log(response.data); |
||||||
|
return response.data; |
||||||
|
}); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
$(document).ready(function() { |
||||||
|
let agent = createAgent("COSMIC","Fewsgereb5"); |
||||||
|
|
||||||
|
}) |
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue