Ok. Basically I am developing a API for Game Server owners who want a custom loading screen that fetches the players name and avatar, but does not use PHP, only JavaScript, AJAX, HTML etc.
This is what I've come up with so far:
<!DOCTYPE html>
<html>
<head><title></title>
<script src="//static.sidewaykill.com/js/jQuery/1.5.2.min.js"></script>
<script src="//static.sidewaykill.com/js/jQuery/ExtDomain.js"></script>
</head>
<body>
<script type="text/javascript">
(function($) {
$.QueryString = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=');
if (p.length != 2) continue;
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
}
return b;
})(window.location.search.substr(1).split('&'))
})(jQuery);
$.get('http://api.sidewaykill.com/steam/name.php?id=76561198017389807')
.success(function(data) {
$('#steamname').html(data);
});
</script>
Welcome <span id="steamname"></span>.<br /><br />
<img src="http://api.sidewaykill.com/steam/avatar.php?id=76561198017389807" alt="Player Avatar" />
</body>
</html>
All I want to do is figure out how to replace those ID= values with the ones provided by the Game. For example, if you access the page via http://server.com/loading.html?id=76561198017389807, it will call api.sidewaykill.com/steam/name.php?id=76561198017389807 and the image api.sidewaykill.com/steam/avatar.php?id=76561198017389807. How would I do this with more jQuery?