我有一个jquery函数,当我点击自定义liferay portlet中列的编辑图标时,它会重定向到我的编辑页面。
但有些当我点击该图标时它只是重新加载页面而不是重定向到我想要的页面
这是我的view.jsp代码
MY PORTLET ACTION URL CODE
<portlet:actionURL var="editrestaurantURL" >
<portlet:param name="jspPage" value="/jsps/edit_restaurant.jsp"/>
点击该jquery的专栏将调用
<td class="editable"><%=temprest.getName() %></td>
这是我的脚本代码
<script>
$(document).ready(function() {
$(".editable").hover(function(){
$(this).append("<i class='splashy-pencil_right'></i>")
}, function(){
$(this).children("i").remove();
});
$(".editable").click(function(){
$.colorbox({
initialHeight: '0',
initialWidth: '0',
href: "#confirm_dialog",
inline: true,
opacity: '0.3',
onComplete: function(){
$('.confirm_yes').click(function(e){
e.preventDefault();
window.location.href = "<%=editrestaurantURL.toString() %> ";
$.colorbox.close();
});
$('.confirm_no').click(function(e){
e.preventDefault();
$.colorbox.close();
});
}
});
});
//* show all elements & remove preloader
setTimeout('$("html").removeClass("js")',1000);
});
</script>
任何人都可以指导我问题在哪里?我不知道哪里出了问题......
答案 0 :(得分:0)
网址的定义:
<portlet:actionURL var="editrestaurantURL" >
<portlet:param name="jspPage" value="/jsps/edit_restaurant.jsp"/>
</portlet:actionURL>
将值存储到EL变量中。检查你是否错过了部分。如果您的javascript工作正常(尝试输入任何静态网址,例如www.google.com),请执行以下操作
...
window.location.href = "${editrestaurantURL}";
...