Mianowicie mam strone główną
index.php
Gdy wczytuje do niej podstrone admin.php za pomocą ajaxa nie działa na niej prawidłwo skrypt do wybierania kolorów z panelu.
Natomiast jeśli jeśli strona admin.php jest otwarta w innej zakładce to jest ok.
Fire bug nic mi nie krzyczy, a ja nie wiem co powoduje ten "błąd"?
index.php
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8" />
<title>Index</title>
<link rel="Stylesheet" type="text/css" href="style.css" />
<meta name="author" content="" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//Strona ladowana jako pierwsza:
$('#box').html("<center><img src='495.GIF'></center>");
$('#box').load('glowna.php');
$('#navigation a#default').addClass("currentpage");
//Ladowanie pozostalych podstron:
$('#navigation a').click(function(e) {
var self = $(this);
var content=$("#box");
$('#navigation a').removeClass("currentpage");
$.ajax({
url: $(this).attr('href'),
error : function(){
content.html("<p>Przepraszamy, ale strona jest chwilowo niedostępna</p>");
},
beforeSend: function(){
content.html("<center><img src='495.GIF'></center>");
self.addClass("currentpage");
},
success: function(obj){
content.html(obj);
},
complete: function(){
}
});
e.preventDefault();
});
});
</script>
</head>
<body class="glowna">
<section>
<article>
<div id="navigation" >
<ul>
<li>
<a href="glowna.php" id="default">główna</a>
</li>
<li>
<a href="admin.php">admin</a>
</li>
<li>
<a href="kontakt.php">kontakt</a>
</li>
</ul>
</div>
<div class="box" id="box">
</div>
<div class="stopka">
</div>
</article>
</section>
</body>
</html>
i admin.php
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8" />
<title>Admin</title>
<link rel="Stylesheet" type="text/css" href="style.css" />
<meta name="author" content="" />
<script type="text/javascript" src="jscolor/jscolor.js"></script>
</head>
<body class="glowna">
<section>
<article>
<div class="dodaj">
<?php
require_once ('functions.php');
connect($adres, $user, $pass, $baza);
$ins = @mysql_query("create table posty (id int auto_increment not null primary key, title varchar(2555),
tresc varchar(999999999),
autor varchar(50),
data TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
tags varchar(2555)) character set UTF8");
?>
<input type="button" value="COLOR=" onclick="java script:color()" >
<input type="text" class="color" id="color">
<form method="post" action="" class="shoutbox" name="dodaj">
<fieldset class="admin">
<textarea type="text" rows="1" cols="100" name="title" id="title" class="title" required placeholder="Tytuł..."></textarea><br>
<textarea type="text" rows="25" cols="100" name="text" id="text" class="text2" required placeholder="Wiadomość..."></textarea><br>
<textarea type="text" rows="1" cols="100" name="tags" id="tags" class="tags" required placeholder="Tagi..."></textarea><br>
<input type="submit" id="submit" value="Go">
</fieldset>
</form>
<?php
if (!empty($_POST['text'])) { $title = $_POST['title'];
$tresc = $_POST['text'];
$tags = $_POST['tags'];
$ins = @mysql_query("INSERT INTO posty SET title='$title', autor='Kamil', tresc='$tresc', tags=' $tags '");
}
koniec($adres, $user, $pass);
?>
</div>
</article>
</section>
</body>
Co może być nie tak?