title: Failed to load resource: the server responded with a status of 500 (Internal Server Error) MVC JAVASCRIPT
body: <p>I'm trying to post 2 param from a view with JavaScript to Controler but i`m getting this error. Dont know why..
  <code>Failed to load resource: the server responded with a status of 500 (Internal Server Error)</code></p>
  
  <p><strong>transfer.js</strong>
  <code>
  $(document).ready(function () {
      $("#transferPlayerButton").click(function () {</code></p>
  
  <pre><code>    var playerId = document.getElementById("id_player").value;
      var teamId = document.getElementById("id_team").value;
  
      $.ajax({
          type: 'post',
          url: '/Player/TransferPlayer',
          data:
              {
                  playerId: playerId,
                  newTeamId: teamId
              },
          contentType: 'application/json;charset=utf-8',
          dataType: 'json',
          success: function (data) {
              alert("Success!");
          }
  
  
      });
  
  });
  </code></pre>
  
  <p><code>});</code></p>
  
  <p><strong>controller</strong></p>
  
  <pre><code>    [HttpPost]
      public ActionResult TransferPlayer(int playerId, int newTeamId)
      {
          return Content(string.Format("Player {0} it is now at team {1}.", playerId, newTeamId)); 
      }
  </code></pre>
  
  <p>and this is my view. I'have been mapped object to database obj but i cand figure out why im getting this 500 error. Need some help. I`m a newbie in mvc/javascript</p>
  
  <pre><code>  @model FotballTeamsProject.Models.PlayerModels.PlayerTransferModel
  
  
      &lt;script src="@Url.Content("~/Scripts/Player/Transfer.js")"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
      var transferUrl= "@Url.Action("TransferPlayer", "Player")";
      &lt;/script&gt;
      &lt;table&gt;
      &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;ID&lt;/th&gt;
          &lt;th&gt;Nume&lt;/th&gt;
          &lt;th&gt;Prenume&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;th&gt;Skill&lt;/th&gt;
          &lt;th&gt;Valoare&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;th&gt;Echipa Actuala&lt;/th&gt;
          &lt;th style="margin-right: 10px;"&gt;Echipa Viitoare&lt;/th&gt;
  
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  
          &lt;tr&gt;
              &lt;td id="id_player"&gt;@Model.Player.id_player&lt;/td&gt;
              &lt;td&gt;@Model.Player.player_firstname&lt;/td&gt;
              &lt;td&gt;@Model.Player.player_surname&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;@Model.Player.player_skill&lt;/td&gt;
  
              &lt;td&gt;@Model.Player.player_value&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;@Model.Player.name_team&lt;/td&gt;
              &lt;td style="text-align: right;"&gt;
                  &lt;select id="id_team"&gt;
                      &lt;option selected="selected" value="0"&gt;Fara echipa&lt;/option&gt;
                      @foreach (var teamInfo in Model.Teams)
                      {
                          &lt;option value="@teamInfo.Key"&gt;@teamInfo.Value&lt;/option&gt;
                      }
                  &lt;/select&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
  
  &lt;/table&gt;
  &lt;/tbody&gt;
      &lt;p&gt;
          &lt;input id="transferPlayerButton" type="button" value="Transfera" /&gt;
      &lt;/p&gt;
  </code></pre>