I'm no javascript guru. I have tryed to find an answer, but no luck.
How can I give a variable the value from a webservice?
my service http://localhost:5000/Token is a basic rest service that returns a simple string.
I can see that my webservice is invoked, but I don't get any alert
Here is my code:
<script type="text/javascript">
window.onload = function () {
function getToken() {
var data = "hello";
$.get("http://localhost:5000/Token", function(response) {
data = response;
}).error(function() {
alert("Sorry could not proceed");
});
return data;
}
var token = getToken();
alert(token);
</script>