0

i am trying to call c# web api but there is no response in html page but i getting response in cshtml WEB API CODE

namespace MvcApplication3.Controllers
{
    public class StoreController : Controller
    {
        public string Get2()
        {
            return "response data";
        }
   }
}

HTML CODE

<html>

<head>
    <script src="jquery-1.8.2.js">

    </script>
    <!--<script src="jquery-1.8.2.min.js">

    </script>-->
    <script type="text/javascript">
        $(function () {
            $(document).ready(function () {
                $('body').on('click', '.test', function (e) {
                    alert('a');
                    jQuery.support.cors = true;
                    $.ajax({
                        // url: 'http://localhost:3595/api/values/5',
                        url: 'http://localhost:1152/Store/Get2',
                        type: 'GET',
                        dataType: "Jsonp",

                        success: function (data) {
                            alert(data);
                        }
                    });
                });
            });
        });
    </script>

    <title>

    </title>
</head>


<body>

<input type="button" value="submit" class="test"/>
</body>


</html>
MethodMan
  • 18,625
  • 6
  • 34
  • 52
ram b
  • 9
  • 2

0 Answers0