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.
- <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $('.search-box input[type="text"]').on("keyup input", function(){
- /* Get input value on change */
- var inputVal = $(this).val();
- var resultDropdown = $(this).siblings(".result");
- if(inputVal.length){
- $.get("backend-search.php", {term: inputVal}).done(function(data){
- // Display the returned data in browser
- resultDropdown.html(data);
- });
- } else{
- resultDropdown.empty();
- }
- });
- // Set search input value on click of result item
- $(document).on("click", ".result p", function(){
- $(this).parents(".search-box").find('input[type="text"]').val($(this).text());
- $(this).parent(".result").empty();
- var javascriptVariable = "error";
- javascriptVariable = document.getElementById('Stationsname').value;
- window.location.href = "./index.php?suchcode=&Standortname=" + javascriptVariable ;
- });
- });
- // </script>
-
-
- // <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
- // <script type="text/javascript">
- $(document).ready(function(){
- $('.search-box2 input[type="text"]').on("keyup input", function(){
- /* Get input value on change */
- var inputVal = $(this).val();
- var resultDropdown = $(this).siblings(".result2");
- if(inputVal.length){
- $.get("backend-search2.php", {term: inputVal}).done(function(data){
- // Display the returned data in browser
- resultDropdown.html(data);
- });
- } else{
- resultDropdown.empty();
- }
- });
- // Set search input value on click of result item
- $(document).on("click", ".result2 p", function(){
- $(this).parents(".search-box2").find('input[type="text"]').val($(this).text());
- $(this).parent(".resul2t").empty();
- var javascriptVariable = "error";
- javascriptVariable = document.getElementById('Adresse').value;
- javascriptVariable = javascriptVariable.substring(0, javascriptVariable.indexOf(' '));
- document.write(javascriptVariable);
- window.location.href = "./index.php?suchcode=" + javascriptVariable + "&Standortname=" ;
- });
- });
- </script>