-1

我的代码有问题。我想知道是否有人可以看看并给我一些关于我哪里出错的提示。

索引.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Load</title>
</head>

<body>
<div class="s1">Load</div>
<div class="physique"></div>

<script>
$(document).ready(function() {

$(".s1").click( function() {                             
    $.ajax({
       type: "POST",
       url: "test.php",
       data: "html",
       data: "start=physique&pass="+$("#pass").val(),
       success: function(msg){
      $(".physique").html(msg).delay(300).fadeIn(300);
       }
    });
    return false;
});

   $("tr").click( function() {                           
    alert("hello");
});
});

</script>
</body>

</html>`

以及生成响应的 php 文件,(我已经删除了大部分内容,只是留下了响应,因为我知道我的错误不是来自 php.test.php

<table id="phys" style="width: 750px">
<tbody>
<tr class="titlte"><td colspan="2">Fichier</td><td>Taille</td><td>Ajouter</td></tr>
<tr class="links" links="<?=$fileurl;?>">
<td style="width: 30px"><img src="dlf/<?    =$icon;?>" alt="<?=$files[$i];?>" /></td>
<td style="width: 550px"><a vref="<?=$fileurl;?>" class="ajaxtrigger">
<strong class="links"><?=$filename;?></strong></a></td>
<td style="width: 70px"><em><?=round(filesize($leadon.$files[$i])/1024);?>KB</em></td>
<td style="width: 100px"><?=date ("M d Y", filemtime($leadon.$files[$i]));?></td></tr>
<tbody>
</table>`

我希望你能帮忙。

4

1 回答 1

0

也许这是$.ajax(...)定义中的错字dataType: html

$.ajax({
   type: "POST",
   url: "test.php",
   dataType: "html",
   data: "start=physique&pass="+$("#pass").val(),
   success: function(msg){
      $(".physique").html(msg).delay(300).fadeIn(300);
   }
});
于 2012-07-23T10:12:45.620 回答