title: javascript: add script to a .js file trouble
body: <p>so for pagination I have this url that when a user press the link it goes to the next page (the link parts are in a partial view), for that to work i get the dropdowbox value with javascript and pass to the url </p>
  
  <pre><code> @Html.ActionLink("|Siguiente &gt;", "Index", new { pagina = Model.PageNumber + 1, ordenacion = ViewBag.Ordenacion, filtro = ViewBag.Filtro , empresa = "param-empresa" }, new { id = "mylinkSig" })
  
  
  
  &lt;script type="text/javascript"&gt;
       $(function () {
              $('#mylinkSig').click(function () {
                  var empresa = $("#empresa").val();
                  this.href = this.href.replace("param-empresa", encodeURIComponent(empresa));
              });
          });
  &lt;/script&gt; 
  </code></pre>
  
  <p>as I use the script in almost all my page i want to put this script in a js file so i dont have to write it in all my view (pages) y try to copy/paste  and put in a js file and it dont work (yes i have the .js file refence in my page)</p>
  
  <p>so iam new to javascript so i dont know if i have to change the function for it could work in the .js file an use it in all my page</p>
  
  <p>edit: </p>
  
  <p>my Helper.js</p>
  
  <pre><code>$(function () {
      $('#mylinkSig').click(function () {
          var empresa = $("#empresa").val();
          this.href = this.href.replace("param-empresa", encodeURIComponent(empresa));
      });
  });
  
  
  function deleteConfirmation(response, status, data) {
  
      // remove the row from the table
      var rowId = "#widget-id-" + response.id;
      $('.widgets').find(rowId).remove();
  
      // display a status message with highlight
      $('#actionMessage').text(response.message);
      $('#actionMessage').effect("highlight", {}, 3000);
      if (response.message == null) {
          alert('No se pudo eliminar el registro');
      }
      else {
          alert(response.message);
      }
  
  }
  </code></pre>
  
  <p>my view </p>
  
  <pre><code>&lt;script src="@Url.Content("~/Scripts/Helper.js")" type="text/javascript"&gt;&lt;/script&gt;
  
  &amp;nbsp;
  @*navigation &lt;&lt; &lt; &gt;&gt;&gt;*@
  &lt;div&gt;
  
      Pagina @(Model.PageCount &lt; Model.PageNumber ? 0 : Model.PageNumber)
      de @Model.PageCount
      &amp;nbsp;
      @if (Model.HasPreviousPage)
      {
          @Html.ActionLink("&lt;&lt;|", "Index", new { pagina = 1, ordenacion = ViewBag.Ordenacion, filtro = ViewBag.Filtro, empresa = "param-empresa" }, new { id = "mylinkFirst" })
          @Html.Raw("&amp;nbsp;");
          @Html.ActionLink("&lt; Anterior|", "Index", new { pagina = Model.PageNumber - 1, ordenacion = ViewBag.Ordenacion, filtro = ViewBag.Filtro, empresa = "param-empresa" }, new { id = "mylinkAnt" })
      }
      &amp;nbsp;
      @if (Model.HasNextPage)
      {
          @Html.ActionLink("|Siguiente &gt;", "Index", new { pagina = Model.PageNumber + 1, ordenacion = ViewBag.Ordenacion, filtro = ViewBag.Filtro , empresa = "param-empresa" }, new { id = "mylinkSig" })
          @Html.Raw("&amp;nbsp;");
          @Html.ActionLink("|&gt;&gt;", "Index", new { pagina = Model.PageCount, ordenacion = ViewBag.Ordenacion, filtro = ViewBag.Filtro , empresa = "param-empresa"}, new { id = "mylinkLast" })
      }
  
  &lt;/div&gt;
  
  &amp;nbsp;
  </code></pre>