ajax in ajax
ajax in ajax
Hi. I have a problem with ajax in ajax. I'm loading files with
load but inside the pages ajax and jquery doesn't work.
In index file i have...
-
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript" src="ajax.js">
</script>
<script type="text/javascript">
$(function(){
$("#osnoven").load("ajax.php", {}, function(){
$("#click").click(function(){
var ajaxa = $("#imdb").val();
alert(ajaxa);
});
});
});
</script>
</head>
<body>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="box">
<tr>
<td class="top">
<a href="#" onclick="ajax('start')">Филми</a>
| <a href="#" onclick="ajax('add')">Добави</a>
</td>
</tr>
<tr>
<td class="other">
<div id="osnoven">
</div>
</td>
</tr>
</table>
</body>
</html>
ajax.js
-
$(function(){
$("#osnoven").load("ajax.php");
$("#click").click(function(){
var ajaxa = $("#imdb").val();
alert(ajaxa);
});
});
function ajax(promenliva){
$("<center><img src='1.gif' alt='loading'></center>").appendTo("#osnoven");
$("#osnoven").load("modules/" + promenliva + ".php");
}
And modules/add.php
-
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript" src="ajax.js">
</script>
</head>
<body>
<center>
<input type="text" size="50" id="imdb"><br>
<input type="button" value="Добави" id="click">
</center>
</body>
</html>
I'm loading the page modules/add.php but when i click on button with id
click it doesn't send me alert.
Sorry for my bad english.