I am trying to call following url using get request.
http://localhost:8080/abc/employees
When I opened above url in browser, I am getting following response.
[{"firstName":"Hari Krishna","id":1,"lastName":"Gurram","permAddrees":{"area":"Marthali","city":"Bangalore","country":"India","state":"Karnataka"},"tempAddrees":{"area":"Electronic City","city":"Bangalore","country":"India","state":"Karnataka"}},{"firstName":"PTR","id":2,"lastName":"PTR","permAddrees":{"area":"Bharath Nagar","city":"Hyderabad","country":"India","state":"Andhra Pradesh"},"tempAddrees":{"area":"BTM Layout","city":"Bangalore","country":"India","state":"Karnataka"}}]
Following is my jquery snippet.
<!DOCTYPE html>
<html>
<head>
<script src = "jquery-3.1.0.js"></script>
</head>
<body>
<h1>Click the below button to see the AJAX response</h1>
<input type="submit" value="click here" id="button1" />
<div id="placeHolder">
</div>
<script type="text/javascript">
var jq = jQuery.noConflict();
jq(document).ready(function(){
jq("#button1").click(function(){
alert("Hello");
jq.get("http://localhost:8080/abc/employees", function(data, status){
alert(data + "" + status);
jq("#placeHolder").html(response);
});
});
});
</script>
</body>
</html>
When I click the button, it is showing first alert box 'alert("Hello");', but the alert box in call back function is not executed. Can any one help me to figure out the issue with my code.




responsein your call, but you're not defining it anywhere - you should be getting an error in console. You're actually making call to/abc/employees/1in the screenshot. By any chance is your output different based upon what header the request uses (json / html)? Also - please not usealertbutconsole.log-alertby default stringifies everything, so it's useless in debugging (you still should have a string in Chrome Response tab irregardless)