Fetch Players Username With JQuery

2018-01-20 17:19:14 | By iDev | idevgames.co.uk
Share:

By using ajax we can pull the username of the player of your game. Pulling the below url with ajax will give you the players username to use in your game or even website.

https://idev.games/request/user

Below is an example of auto populating an input field in jQuery.

<html>
<head>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script>
$.ajax({
 
url : 'https://idev.games/request/user',
type : 'GET',
dataType:'json',
error : function(request,error)
{
$( "#yourId" ).val(request['responseText']);
}
});
</script>
</head>
<body>
<form>
<input id="yourId">
</form>
</body>
</html>

 

3 Login to like

Comments

Would you like to comment on this post? Create a free account in less than 1 minute.

Back to top

! VitalProxies _... Bump Reminder Destus DISBOARD Dyno
12 Online Discord
·