我在html中有这个注销按钮,
<a href="<?php echo PSF::urlFor('logout');?>" class="link" id="position">Logout</a></li>
它进入PSF类并搜索注销功能,并注销用户。 它工作正常。
现在我想尝试在弹出窗口中执行相同操作,通过,
return json_encode (
array(
'errors' => array(
'Sorry you are already logged in, please Logout from other Devices or click to"<a href="echo PSF::urlFor('logout');" class="link" id="position">Logout</a>"'
)
)
);
这个json被发送到,
if (d.errors) {
$("#load-overlay-elt").isLoading("hide");
$('#login_wait').button('reset');
a.empty();
var msg='';
$.each(d.errors, function(i, n){
//a.append(n + '<br/>');
msg += n + ', ';
});
$.auctions.alert(msg);
a.show();
}
邮件已打印,但注销按钮似乎无法正常工作,我错过了什么?
答案 0 :(得分:1)
您应该更改
行return json_encode (array('errors' => array( 'Sorry you are already logged in, please Logout from other Devices or click to"<a href="echo PSF::urlFor('logout');" class="link" id="position">Logout</a>"')));
到
return json_encode (array('errors' => array( 'Sorry you are already logged in, please Logout from other Devices or click to <a href="' . PSF::urlFor('logout') . '" class="link" id="position">Logout</a>"')));
因为它在语法上是不正确的。