title: tempdata value not getting through ajax call on controller on checkbox event
body: <p>i want to send parameter to my controller.this is my view page:</p>
  
  <pre><code>&lt;div&gt;
    &lt;li&gt; &lt;input name="chk" type="checkbox" value="1"&gt; electronics &lt;/li&gt;
    &lt;li&gt; &lt;input name="chk" type="checkbox" value="2"&gt; Construction&lt;/li&gt;
    &lt;li&gt; &lt;input name="chk" type="checkbox" value="1"&gt; Hardware&lt;/li&gt;
      &lt;div class="row service-block" id="results"&gt;
        @Html.Partial("_searchPartial", Model)
      &lt;/div&gt;
  &lt;/div&gt;
  
  
   $("input[type='checkbox']").on('change', function () {
              var checkboxes = document.getElementsByName('chk');
              var vals = "";
              for (var i = 0, n = checkboxes.length; i &lt; n; i++) {
                  if (checkboxes[i].checked) {
                      vals += "," + checkboxes[i].value;
                  }
              }
              if (vals) vals = vals.substring(1);
              $.ajax({
                  url: "/Search/SearchWorkers",
                  type: "GET",
                  dataType: 'html',
                  data: { checkCategoriesId: vals,"City": "@ViewBag.City", "OrderBy": "@TempData["OrderBy"]" },
                  contentType: "text/html;charset=utf-8",
                  success: function (responce)
                  {
                      $("#results").html(responce);
                  },
                  error:function (xhr, ajaxOptions, thrownError)
                  {
                      alert("test");
                  }
              })
          });
  </code></pre>
  
  <p>This is my controller:
   first of all i am calling this method where i am preserving orderby value.</p>
  
  <pre><code>[HttpGet]
          public ActionResult SearchPaging(string ItemSearchText,string City, string OrderBy, int PageNo, string Zipcode, string Flag,string checkCategoriesId)
          {
              TempData["OrderBy"] = OrderBy;
              return PartialView("_searchPartial", userDetailsModel.OrderBy(v =&gt; v.Fullname).ToPagedList(PageNo, 1));
      }
  
  
  
  
  [HttpGet]
  public ActionResult SearchWorkers(string checkCategoriesId,string OrderBy,string Flag,string City, int PageNo = 1)
  { 
   TempData["OrderBy"] = OrderBy
    return PartialView("_searchPartial", userDetailsModel.OrderByDescending(p =&gt; p.CreatedDate).ToPagedList(PageNo, 1));
  }
  </code></pre>
  
  <p>i have checked tempdata value and it is showing value on view page.</p>
  
  <p>but when i am firing checkbox change event and i am passing tempdata value then i am getting null value.</p>
  
  <p>i dont know whats the problem</p>
  
  <p>can anybody figure out?</p>