title: How to call controller from jquery in MVC?
body: <p>I want to call my controller from view by Jquery which returns count. While debugging the result variable returns as undefined. Please someone correct my code.</p>
  
  <p>View:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function () {
      $('.icon-delete').click(function () {
          debugger;
          var v = 'e8a6bdf4-1da6-41e0-8423-86ffacf71703';
         var result= GetCollectionCount(v);
          var answer = confirm('Do you want to delete this record?');
          if (answer) {
              $.post(this.href, function () {
                  window.location.reload(); //Callback
              });
              return false;
          }
          return false;
      });
  });
  
  function GetCollectionCount(id) {
      $.ajax({
          type: 'POST',
          contentType: "application/json;charset=utf-8",
          url: '/AdminNew/CollectionCount',
          dataType: 'json',
          data: { "id": id },
          //traditional: true,
          success: function (ajaxresult) {
              //alert(ajaxresult);
              return ajaxresult;
          },
          failure: function (ajaxresult, status) {
              console.log(ajaxresult)
          }
      });
  }
  </code></pre>
  
  <p></p>