动态jQuery attr()href

时间:2012-06-15 19:12:12

标签: php jquery href

我有一个图像滑块。每个图像都有自己的链接。 滑块在 PHP 中生成,带有for循环。

我想动态地将滑块中的图像链接与我网页上其他位置的链接相关联。

我在php for循环中做了这个:

$(document).ready(function(){
    $("#ProgrammeImmobilierNeuf")
       .attr("href", "<?php echo URL.'p-'.$picturesSlider[$i]['id_programme_ws'].'/Programme-immobilier-neuf-'.strtolower($urlVille).'/'.rewriteProgramme($picturesSlider[$i]['nom']).'.html'; ?>");
});

这不会更新链接。

有人能帮助我吗?

1 个答案:

答案 0 :(得分:1)

如果$不是echo URL,我认为您忘记了URL中的constant

..."<?php echo $URL.'p-'.$picturesSl...
相关问题