Last active
August 30, 2017 22:50
-
-
Save sarnobat/d95d966656201314d549615b3ef5991c to your computer and use it in GitHub Desktop.
jQuery call REST service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$("button").click(function(){ | |
$.getJSON("http://localhost:9099/helloworld/json?param1=" + encodeURIComponent(document.getElementById("urls").innerHTML),function(result){ | |
$.each(result, function(i, field){ | |
$("#items").append(i + " " + field + " "); | |
}); | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<textarea id="urls">http://www.yahoo.com</textarea> | |
<button>Stash this</button> | |
<div id="items"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment