title: Calling ActionResult using jquery ajax in .net core
body: <p>Action in controller</p>
  <p>Method GetById is the same as the Find method and EntityUpdate == Update</p>
  <pre><code>public IActionResult CategoryStatus(int id)
      {
          var data = cm.GetById(id);
          if (data.CategoryStatus)
          {
              data.CategoryStatus = false;
          }
          else
          {
              data.CategoryStatus = true;
          }
          cm.EntityUpdate(data);
          return RedirectToAction(&quot;Index&quot;);
      }
  </code></pre>
  <p>I want to call this action from razor view with ajax, can anyone help , thanks.</p>
  <p>I add some parts of razor view just in case</p>
  <pre><code> &lt;a href=&quot;/Admin/Category/CategoryStatus/@item.CategoryID&quot;
      class=&quot;btn btn-outline-success btn-sm&quot;
      onclick=&quot;return functionConfirm(this)&quot;&gt;
      Aktivləşdir
   &lt;/a&gt;
  &lt;script&gt;
  function functionConfirm(event) {
            swal({
          title: 'Are you sure?',
          text: &quot;You will not be able to recover this item!&quot;,
          type: 'warning',
          showCancelButton: true,
          cancelButtonText: 'No',
          cancelButtonClass: 'btn btn-danger',
          showConfirmButton: true,
          confirmButtonText: 'Yes',
          confirmButtonClass: 'btn btn-success'
      }, function (isConfirm) {
          if (isConfirm) {
              $.ajax({//I need your help here
                  type: &quot;GET&quot;,
                   url: '/Admin/Category/CategoryStatus',
                  success: function (msg) {
                      console.log(msg);
                   },
                  error: function (req, status, error) {
                      console.log(msg);
                  }
              });
              return true;
          } else {
              return false;
          }
      });
      return false;                                                                                                                                                                                                                                           
  }
  </code></pre>