title: Why is my Jquery Ajax call not working?(Asp.net MVC C#)
body: <p>My aim was to use ajax to retrieve some data from my controller and append this to a table element in my view. However the javascript code only works until "$.ajax(" at which point it just stops. I placed some break points after the above mentioned point but the code never "broke" at those points. </p>
  
  <p>This is the javascript code</p>
  
  <pre><code>$(document).ready(function ()
  {
      $("#DivisionId").change(function () {
          var OptionId = $('#DivisionId').val();
          var position = 0;
          $.ajax(
              {
                  type: 'POST',
                  url: '@URL.Action("Division")',
                  dataType: 'json',
                  data: { DivisionId: OptionId },
                  success: function (data) {
                      var LogStandings = '';
                      $.each(data, function (i, log) {
                          position++;
                          var Logs = "&lt;tr&gt;" +
                              "&lt;td&gt;" + position + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.Team.TeamName + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.Played + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.Win + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.Draw + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.Lost + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.GoalsFor + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.GoalsAgainst + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.GoalDifference + "&lt;/td&gt;" +
                              "&lt;td&gt;" + log.Logs1.Points + "&lt;/td&gt;" +
                              "&lt;/tr&gt;";
                          $('#TheLog').append(Logs);
                      });
  
                  },
                  error: function (ex) {
                      var r = jQuery.parseJSON(response.responseText);
                      alert("Message: " + r.Message);
                      alert("StackTrace: " + r.StackTrace);
                      alert("ExceptionType: " + r.ExceptionType);
                  }
              });
          return false;
  
      }); // end of Division on change function
  
  })//End of document.ready function
  </code></pre>
  
  <p>This is the code in my controller</p>
  
  <pre><code>        public JsonResult Division(int DivisionId)
          {
              int UnderId = db.Under.FirstOrDefault().UnderID;
              MainDivisionId = id;
  
  
              List&lt;FixtureModel&gt; Fixtures = db.Fixtures.Where(f =&gt; f.TeamModel.DivisionId == id &amp;&amp; f.TeamModel.UnderId == UnderId).ToList();
              List&lt;ResultModel&gt; Results = db.Results.Where(r =&gt; r.Fixtures.TeamModel.DivisionId == id &amp;&amp; r.Fixtures.TeamModel.UnderId == UnderId).ToList();
              List&lt;LogModel&gt; Logs = db.Logs.Where(l =&gt; l.Team.DivisionId == id &amp;&amp; l.Team.UnderId == UnderId).ToList();
  
              IndexViewModel IndexPage = new IndexViewModel(Fixtures, Results, Logs);
  
              return Json(IndexPage , JsonRequestBehavior.AllowGet);
          }
  </code></pre>
  
  <p>I searched a little on the internet and one source suggested that I place my jquery CDN at the top of my view within the head tag, this did not solve my problem though. Besides that I have not been able to find any other solutions after an hour of searching. </p>