ajax - Unable to fetch data from json file using jquery -


currently working on project have fetch information web api web application using jquery.

<script src="jquery-1.11.2.js"></script> <script src="jquery-1.11.2.min.js"></script> <script type="text/javascript">  $(document).ready(function () {         jquery.support.cors = true;         $("#btn").click(function () {             $.ajax({                 url: "http://localhost:52227/api/values",                 type: "get",                 datatype: "json",                 success: function (data) {                     alert("hello");                 }             });         });     }); </script> 

<body> <form id="form1" runat="server"> <div>     <input type="button" id="btn" value="submit" /> </div> </form> 

when run application not showing me output.

the code have provided syntactically correct. request failing , haven't provided error function request. can add error callback this

$.ajax ( {     url: "http://localhost:52227/api/values",     type: "get",     datatype: "json",     success: function (data) {         alert("hello");     },     error: function (data) {         alert("test");     } } ) 

here jsfiddle showing in action.

http://jsfiddle.net/1mqotn6v/2/


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -