Hallo ! Ich arbeite mich gerade in das JQuery Framework ein und bin nun bei Ajax angekommen. Leider bin ich noch sehr neu in PHP und bekomme nicht mein gewünschtes Ergebnis.
könnte mir vorstellen das mein PHP code totaler irrsinn ist
hoffe mir kann jemand helfen
lg
Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <!-- Einbinden des JQuery Frameworks --> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> function ModellChange() { /*$(document).ready(function() { var marke = $("#MarkeList :selected").text(); alert(marke); })*/ $(document).ready( function() { $.ajax({ type:"GET", datatype:"text", url:"daten.php", data:marke, success:function(htmlCode) { $("#Modell").html(htmlCode); } }) }) } </script> </head> <body> <div id="Marke"> <select id="MarkeList" name="MarkeList" onchange="ModellChange()"> <option>--------</option> <option>Mercedes</option> <option>Audi</option> <option>Opel</option> </select> </div> <div id="Modell"> <!-- Hier erscheint das zweite Dropdown Menu --> </div> <div id="Baujahr"> <!--Hier erscheint das dritte Dropdown Menu --> </div> </body> </html>
PHP-Code:
<?php
echo "test <br \>";
if($_GET == 'Mercedes') {
echo
"<select name=\"\">
<option>SLK</option>
<option>A-Klasse</option>
<option>E-Klasse</option>
</select>";
}
?>

lg
Kommentar