diff --git a/suche.php b/suche.php index c0e44ae..940c5ff 100755 --- a/suche.php +++ b/suche.php @@ -42,59 +42,33 @@ select{ --> </style> -<script type='text/javascript' src='ajax.js'></script> + +<script src='jquery-3.4.1.min.js'></script> <script type='text/javascript'> -/************************************************************************************************************ -Ajax chained select -Copyright (C) 2006 DTHMLGoodies.com, Alf Magne Kalleland - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Dhtmlgoodies.com., hereby disclaims all copyright interest in this script -written by Alf Magne Kalleland. - -Alf Magne Kalleland, 2006 -Owner of DHTMLgoodies.com - - -************************************************************************************************************/ -var ajax = new sack(); - -function getCityList(sel) -{ - var countryCode = sel.options[sel.selectedIndex].value; - document.getElementById('dhtmlgoodies_city').options.length = 0; // Empty city select box - if(countryCode.length>0){ - ajax.requestFile = 'getSubCat_search.php?countryCode='+countryCode; // Specifying which file to get - ajax.onCompletion = createCities; // Specify function that will be executed after file has been found - ajax.runAJAX(); // Execute AJAX function - } +function fetch_select(){ + var kontinent = document.getElementById('kontinent').options[document.getElementById('kontinent').options.selectedIndex].value; + + $.ajax({ + type: 'POST', + url: 'get_land.php', + data: { + 'function': 'fetch_select', + 'kontinent': kontinent + }, + success: function(result) { //we got the response + document.getElementById('land').innerHTML=result; + }, + error: function(xhr, status, exception) { + console.log(xhr); + } + }); } - -function createCities() -{ - var obj = document.getElementById('dhtmlgoodies_city'); - eval(ajax.response); // Executing the response from Ajax as Javascript code -} - - </script> + <link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\"> </head> <body onload=\"if(document.auswert)document.auswert.dhtmlgoodies_country.focus();if(document.auswert)document.auswert.uberschrift.focus();return false;\"> @@ -128,9 +102,9 @@ function createCities() ORDER BY kontinent ASC"; $result2 = $db->query ($query2) or die ("Cannot execute query"); - echo "<select id='dhtmlgoodies_country' name='dhtmlgoodies_country' onchange='getCityList(this)' onfocus='getCityList(this)'> + echo "<select id='kontinent' name='kontinent' onchange='fetch_select();'> <option value=''>Select</option>"; - echo "<option value='%'";if($row3['kontinent'] == '%'){echo " selected";} echo">Alle </option>\n"; +# echo "<option value='%'";if($row3['kontinent'] == '%'){echo " selected";} echo">Alle </option>\n"; while ($row2 = $result2->fetch_array()){ echo "<option value='$row2[kid]'";if($row2['kid'] == $row3['kontinent']){echo " selected";} echo">".$row2['kontinent']." </option>\n"; } @@ -144,7 +118,8 @@ function createCities() Land </td> <td width='70%' style='border-right-style: solid; border-right-width: 2px'> <p style='margin-left: 3px; margin-right: 3px'> - <select id='dhtmlgoodies_city' name='dhtmlgoodies_city'> + <select id='land' name='land'> + </select> </p> </td> </tr> @@ -203,17 +178,17 @@ function createCities() break; case "auswertung": -if(!isset($_POST['dhtmlgoodies_country'])){ +if(!isset($_POST['kontinent'])){ $kontinent=$_GET['kontinent']; }else{ - $kontinent=$_POST['dhtmlgoodies_country']; + $kontinent=$_POST['kontinent']; } -if(!isset($_POST['dhtmlgoodies_city'])){ +if(!isset($_POST['land'])){ $land=$_GET['land']; }else{ - $land=$_POST['dhtmlgoodies_city']; + $land=$_POST['land']; } if(!isset($_POST['jahrgang'])){