Ich habe ein Problem mit Ajax und CSS
Wenn ich eine Wert vom Ajax zurück kriege wird CSS komplett ignoriert.
Hier der Code
Was habe ich falsch gemacht
Wenn ich eine Wert vom Ajax zurück kriege wird CSS komplett ignoriert.
Hier der Code
HTML Code:
<!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" xml:lang="de" lang="de"> <head> <title>jQuery-Tutorial: Ajax</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.2.0.css" /> <script type="text/javascript" src="jquery.mobile/jquery-1.8.2.js"></script> <script type="text/javascript" src="jquery.mobile/jquery.mobile-1.2.0.js"></script> <script type="text/javascript"> $(document).ready(function(){ // jQuery-Code $("#ajaxcontent").css({ "width": 200, "height": 200, "border": "1px solid" }); $("button").css({ "display": "block" }); $("#ajaxloadlink").click(function(){ $("#ajaxcontent").load("ajax.php"); }); $("#ajaxloadlink").click(function(){ $("#ajaxcontent").load( "ajax.php", { ajaxpost: "post()-Daten (POST)" } ); }); $("#ajaxloadlink").click(function(){ $("#ajaxcontent").load( "ajax.php", { ajaxpost: "post()-Daten (POST)" }, function (responseText, textStatus, XMLHttpRequest){ alert( responseText + ", " + textStatus + ", " + XMLHttpRequest ); } ); }); $("#ajaxgetlink").click(function(){ $.get("ajax.php", { ajaxget: "get()-Daten (GET)" }, function(data){ $("#ajaxcontent").html(data); } ); }); $("#ajaxcontent, #ajaxgetlink").click(function(){ $.get("ajax.php", { ajaxget: "get()-Daten (GET)" }, function(data){ $("#ajaxcontent").html(data); } ); }); $("#ajaxpostlink").click(function(){ $.post("ajax.php", { ajaxpost: "post()-Daten (POST)" }, function(data){ $("#ajaxcontent").html(data); } ); }); $("#ajaxlink").click(function(){ $.ajax({ type: "GET", url: "ajax.php", data: "ajaxget=ajax()-Daten+(GET)", success: function(data){ $("#ajaxcontent").html(data); } }); }); $("#ajaxscriptlink").click(function(){ $.getScript("script.js", function(){ $("#ajaxcontent").html("getScript() geladen."); }); }); }); </script> </head> <body> <button id="ajaxgetlink">Lade ajax.php mit get()</button> <div id="ajaxcontent"> </div> </body> </html>
PHP Code:
<?php
if ($_GET) {
echo '<button id="ajaxloadlink">Lade ajax.php mit load()</button>';
} else if ($_POST) {
echo $_POST["ajaxpost"];
} else {
echo '<button id="ajaxloadlink" class="menu">Lade ajax.php mit load()</button>';
}
?>
Comment