title: Why am I getting json response page after ajax post call?
body: <p>I have an aps.net MVC5 web app, I have a controller action post method that looks like this,</p>
  <pre><code>   [HttpPost]
          [ValidateAntiForgeryToken]
          public ActionResult Set(int id)
          {
              DbHelper dbHelper = new DbHelper();
              dbHelper.Update&lt;News&gt;(&quot;update news set ispublished = 1, publishdate = @PublishDate  where newsid = @NewsId&quot;, new { NewsId = id, PublishDate = DateTime.Now });
              return Json(new { success = true, message = &quot;added successfully!&quot;, redirectToUrl = Url.Action(&quot;NewsList&quot;, &quot;Home&quot;) }, JsonRequestBehavior.AllowGet);
          }
  </code></pre>
  <p>Now, when I call this method from my View ,</p>
  <pre><code> $(document).on(&quot;click&quot;, &quot;.set&quot;, function () {
  
          var mId = $(this).attr(&quot;data-model-id&quot;);
          $.ajax({
              url: &quot;@Url.Action(&quot;Set&quot;,&quot;Home&quot;)&quot;,
              data: { &quot;id&quot;: mId },
              contentType: 'application/json',
              type: 'POST',
              dataType:'json',
              success: function (response) {
                  if (response.success) {
                      window.location.href = response.redirectToUrl;
                      dt.ajax.reload();
  
                      $.notify(data.message, {
                          globalPosition: &quot;top center&quot;,
                          className: &quot;success&quot;
                      });
                  }
              },
              error: function (response) {
                  $.notify(response.message, {
                      globalPosition: &quot;top center&quot;,
                      className: &quot;success&quot;
                  });
              }
          });
      });
  </code></pre>
  <p>I am always getting this <a href="https://i.stack.imgur.com/FLdPc.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>I expect to be redirected to home/newslist url. I tried changing all the parameters of ajax call , adding and removing them, still no matter what I do, I always land at this page.</p>