-1
a-link在index.php中工作。但是,如果a-link來自ajax響應,A-link不起作用,我想通過響應a-link來調用相同的功能。這裏是我的完整代碼。請用完整的代碼解釋。如何通過ajax響應鏈接調用相同的功能
的index.php
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script>
$(document).ready(function(){
function SelRej(){
var SRvalue = $(this).attr("value");
//alert(SRvalue);
var URL = "Ajax.php";
$("#"+SRvalue).load(URL, {
"SRvalue":SRvalue
});
if(SRvalue=="Reject"){$("#Select").html("<a href='#' class='Select' value='Select'>Select</a>");}
if(SRvalue=="Select"){$("#Reject").html("<a href='#' class='Reject' value='Reject'>Reject</a>");}
return false;
}
$(".Select").on('click', SelRej);
$(".Reject").on('click', SelRej);
});
</script>
</head>
<body>
<div id="Select"><a href='#' class='Select' value="Select">Select</a></div>
<div id="Reject"><a href='#' class='Reject' value="Reject">Reject</a></div>
</body>
</html>
Ajax.php
<?php
if($_REQUEST["SRvalue"]){
$SRvalue = $_REQUEST['SRvalue'];
if($SRvalue=="Select"){echo "Selected";}
if($SRvalue=="Reject"){echo "Rejected";}
}
?>