title: make javascript code content dropdownlist dependant
body: <p>I found this code on the internet, I'm using it to populate a textbox with autocomplete elements, the problem I have tho is that I also have a DropDownList that lets you choose between three languages, and I would like to change a parameter depending on the selected language. This is the code:</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
  
  $(function () {
      $('#&lt;%=txtCompanyName.ClientID%&gt;').autocomplete({
          source: function (request, response) {
              $.ajax({
                  url: "Default.aspx/GetCompanyName",
                  data: "{ 'pre':'" + request.term + "'}",
                  dataType: "json",
                  type: "POST",
                  contentType: "application/json; charset=utf-8",
                  success: function (data) {
                      response($.map(data.d, function (item) {
                          return { value: item }
                      }))
                  },
                  error: function (XMLHttpRequest, textStatus, errorThrown) {
                      alert(textStatus);
                  }
              });
          }
      });
  });
  </code></pre>
  
  <p></p>
  
  <p>I would like to change the "url: Default.aspx/GetCompanyName" parameter everytime I switch the language on the DropDownList. I tried a lot of things, but I think the closest was this:</p>
  
  <pre><code>...
  if(document.getElementById('DropDownListName').value == "Company")
  url: "Default.aspx/GetCompanyName",
  } else {
  url: "Default.aspx/IgnoreInput",
  }
  ...
  </code></pre>
  
  <p>Thanks in advance for the help!</p>