Problems after 2nd autocomplete script

Problems after 2nd autocomplete script

Hy @ all

Im not good in php, html,... but i got a little page to work for me and my colleges.
It takes me some time to get autocomplete to work but finally i was happy.

Then i insert the script-part a second time (yes its not a fine way) and changed the necessary parts and also the second autocomplete worked fine.

BUT since that time umlauts (ä,ü,ö...) are displayed wrong (ö = Ã¶)
if i remove the second script everything is normal again.

if somebody has any idea i would be graceful.


  1.     <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  2.     <script type="text/javascript">
  3.     $(document).ready(function(){
  4.         $('.search-box input[type="text"]').on("keyup input", function(){
  5.             /* Get input value on change */
  6.             var inputVal = $(this).val();
  7.             var resultDropdown = $(this).siblings(".result");
  8.             if(inputVal.length){
  9.                 $.get("backend-search.php", {term: inputVal}).done(function(data){
  10.                     // Display the returned data in browser
  11.                     resultDropdown.html(data);
  12.                 });
  13.             } else{
  14.                 resultDropdown.empty();
  15.             }
  16.         });       
  17.         // Set search input value on click of result item
  18.         $(document).on("click", ".result p", function(){
  19.             $(this).parents(".search-box").find('input[type="text"]').val($(this).text());
  20.             $(this).parent(".result").empty();
  21.             var javascriptVariable = "error";
  22.             javascriptVariable = document.getElementById('Stationsname').value;
  23.             window.location.href = "./index.php?suchcode=&Standortname=" + javascriptVariable ;
  24.         });
  25.     });
  26.    // </script>
  27.  
  28.     
  29.   //  <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  30.   //  <script type="text/javascript">
  31.     $(document).ready(function(){
  32.         $('.search-box2 input[type="text"]').on("keyup input", function(){
  33.             /* Get input value on change */
  34.             var inputVal = $(this).val();
  35.             var resultDropdown = $(this).siblings(".result2");
  36.             if(inputVal.length){
  37.                 $.get("backend-search2.php", {term: inputVal}).done(function(data){
  38.                     // Display the returned data in browser
  39.                     resultDropdown.html(data);
  40.                 });
  41.             } else{
  42.                 resultDropdown.empty();
  43.             }
  44.         });       
  45.         // Set search input value on click of result item
  46.         $(document).on("click", ".result2 p", function(){
  47.             $(this).parents(".search-box2").find('input[type="text"]').val($(this).text());
  48.             $(this).parent(".resul2t").empty();
  49.             var javascriptVariable = "error";
  50.             javascriptVariable = document.getElementById('Adresse').value;
  51.             javascriptVariable = javascriptVariable.substring(0, javascriptVariable.indexOf(' '));
  52.             document.write(javascriptVariable);
  53.             window.location.href = "./index.php?suchcode=" + javascriptVariable + "&Standortname="  ;
  54.         });
  55.     });
  56.     </script>