Hallo,
wie kann ich in jquery eine Variable anlegen?
ich möchte der Variablen Text aus einer PHP Datei zuweiseh:
Leider klappt das irgendwie nicht .....
siehe code page_home ....
index.php
setup.php:
setup.js:
wie kann ich in jquery eine Variable anlegen?
ich möchte der Variablen Text aus einer PHP Datei zuweiseh:
Leider klappt das irgendwie nicht .....
siehe code page_home ....
index.php
HTML:
<!doctype html public "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/css/edu.css">
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" language="javascript" src="setup.js"></script>
</head>
<body>
<center><div id="container">
<div id="content"></div>
</div></center>
</body>
</html>
setup.php:
PHP:
<?php
$last_line = system("uname -m");
echo "hallo: " . $last_line;
?>
setup.js:
Javascript:
var pc_arch; // pc architecture
$(document).ready(function(){
this.page = 0;
function page_header() {
$("#container").html("<table border='0' cellspacing=0px cellpading=0px style='border:0px;border-spacing:0px;'><tr><td><img src='/img/logo.gif'></td><td valign='bottom'><img src='/img/title.gif'</td></tr>"+
"</tr><tr><td colspan='2'><center><font color='white'>.: "+
"<a href='#' id='home'>Home</a> .:. "+
"<a href='#' id='hilfe'>Mathe</a> .:. "+
"<a href='#' id='impressum'>Impressum</a> :.</font><hr></center></td></tr>");
}
function page_footer() {
$("#container").append("<tr><td><center><hr><font face='verdana' color='white' size='2'>"+
"Thanks for visiting np-reloaded<br>"+
"© 2014 paulemh - All Rights Reserved.</center></font></td></tr></table>");
}
function start_page(page) {
page_header();
page_content(0);
page_footer();
}
function page_content(page) {
if (page == 0) {
run_home();
$("#container").append("<tr><td align='left'><font face='arial' color='white' size='2'>"+
"oop: " + pc_arch + "</td></tr>");
}
else if (page == 1) {
$("#container").append("<table border='0'><tr><td width='100%'><center>"+
"<tr><td><font color='white'>"+
"test"+
"</td></tr>");
}
}
function run_home() {
var pca = $.get("setup.php", function(data) {
$(pc_arch).val(data);
})
.done(function(data) { $(pc_arch).val(data); });
}
function set_page(page){
page_header();
page_content(page);
page_footer();
}
$("#home" ).live("click",function(){ set_page(0); return true; });
$("#hilfe").live("click",function(){ set_page(1); return true; });
if (this.page == 0)
start_page(this.page);
});
Zuletzt bearbeitet von einem Moderator: