0
這是腳本如何術語塞傳遞到AJAX功能參數
var $mainCat=$('#main_cat').val();
的原代碼,我用這個
var $mainCat=$('#<how to pass the slug here>').val();
echo '<ul>';
foreach ($termchildren as $child) {
$term = get_term_by('id', $child, $taxonomyName);
echo '<li><a href="#" id=' .$term->slug. '>' . $term->name . ' </a></li>';
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript">
$(function()
{
$('a#<?php echo $term->slug; ?>').click(function()
{
$('#pop-up1').show();
$('#pop-up').show();
<?php echo $term->slug; ?>
var $mainCat=$('#<how to pass the slug here>').val();
取代現在我需要通過「a href」價值,例如, term-> slug到變量$ mainCat。我如何能做到這一點,請幫我