Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{"username":"demo","email":"demo@gmail.com","password":"123"}]
- <form>
- Enter Username:<br>
- <input type="text" id="usernameEn" name="username"><br>
- <button id="btnGet">Save</button>
- </form>
- <br><br>
- <form>
- Username:<br>
- <input type="text" id="username" name="username"><br>
- Email:<br>
- <input type="text" id="email" name="email"><br><br>
- Password:<br>
- <input type="text" id="password" name="password"><br><br>
- </form>
- <script type="text/javascript">
- $(document).ready(function()
- {
- $("#btnGet").click(function(event)
- {
- event.preventDefault();
- $.ajax({
- type: 'GET',
- url: "http://localhost:8080/WebServiceTest2/webresources/users/get/" + $('#usernameEn').val(),
- dataType: "json",
- success: function(data) {
- console.log(data);
- var userDetails = data;
- renderDetails(userDetails);
- },
- error: function(jqXHR, textStatus, errorThrown) {
- alert('addWine error: ' + textStatus);
- }
- });
- });
- });
- function renderDetails(data)
- {
- $('#username').val(data.username);
- $('#email').val(data.email);
- $('#password').val(data.password);
- };
- </script>
Add Comment
Please, Sign In to add comment