我在 Ajax 调用中遇到了工作 JS 的问题。JS 正常工作,直到我从数据库中获取新数据或收到 ajax 调用。Ajax 调用工作正常,只是 Javascript 不加载。请帮忙。
这是示例 index.php。
<!-- library -->
<script type="text/javascript" src="js/deleting_data.js"></script>
<link href="css/forme.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript" src="js/funkcije.js"></script>
<link rel="stylesheet" type="text/css" href="css/dinamicno_iskanje.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.ausu-autosuggest.min.js"></script>
<div id="load" align="center"><img src="images/loading.gif" width="28" height="28" align="absmiddle"/> Loading...</div>
<div id="seek">//here comes refreshed data, with ajax call
<table class="content" style="border-collapse: separate; border-spacing: 0px 5px; ">
<?php
while($row=mysql_fetch_array($query))
{
//data from database
</table></div>
<div id="delete"></div> //ajax call for deleting data
这是refreshed_data.php
<!-- library -->
<script type="text/javascript" src="js/deleting_data.js"></script>
<link href="css/forme.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript" src="js/funkcije.js"></script>
<link rel="stylesheet" type="text/css" href="css/dinamicno_iskanje.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.ausu-autosuggest.min.js"></script>
<div id="load" align="center"><img src="images/loading.gif" width="28" height="28" align="absmiddle"/> Loading...</div>
<table class="content" style="border-collapse: separate; border-spacing: 0px 5px; ">
<?php
while($row=mysql_fetch_array($query)
{
//refreshed data
?>
</table>
<div id="delete"></div>//ajax call for deleting data
这是deleting_data.js,页面加载时正常工作。
$(document).ready(function () {
//$(".gumb").live("click",function(){
$('#load').hide();
$('#brisanje').hide();
});
$(function () {
//$(".gumb").click(function() {
$(".gumb").live("click", function () {
$('#load').fadeIn();
$('#brisanje').fadeIn();
$(this).parent().parent().fadeOut(1000, function () {
$(this).remove();
});
$('#load').fadeOut();
$('#brisanje').fadeOut(1000);
});
});