controller中的php文件如下 public function delete($notice_seq='')
{
$notice_seq = (int) $notice_seq;
if($notice_seq == 0){$this->msg("ERROR");}
$nt = Cl::get('Notice');
$nt->load($notice_seq);
$nt->delete(); //执行该函数可以删除相关项
}view中的代码如下
<td class="td7">delete</td>js代码如下
SioOrderManager.prototype.draw = function(json)
{
.............
tag.push('<td class="td7"><button class="btn delete">delete</button></td>'); };
SioOrderManager.prototype.draw_event = function()
{
$(this.root+'>tbody>tr>td>button.delete').click(function(){
notice_del($(this).parent().parent().children('td.td1').children(':checkbox').val());
});
};。。
function notice_del(notice_seq)
{
var UserInfoWin = window.open('http://gw.'+DOMAIN+'/hr/notice/delete/'+notice_seq,
'UserInfoWin',
'top=0,left=0,toolbar=0,directories=0,menubar=0,resizable=0,scrollbars=1,width=800,height=650');
UserInfoWin.focus();
}现在情况是点击delete按钮的话,相关项会被删除掉,但是会弹出新窗口,空白的。怎么才能不弹出新窗口,而直接删除。上面的notice_del函数就是弹出窗口的函数,但如果不执行这个,就不能到/hr/notice文件,并执行delete函数。这个/hr/notice/delete/ 是controller中的delete函数
{
$notice_seq = (int) $notice_seq;
if($notice_seq == 0){$this->msg("ERROR");}
$nt = Cl::get('Notice');
$nt->load($notice_seq);
$nt->delete(); //执行该函数可以删除相关项
}view中的代码如下
<td class="td7">delete</td>js代码如下
SioOrderManager.prototype.draw = function(json)
{
.............
tag.push('<td class="td7"><button class="btn delete">delete</button></td>'); };
SioOrderManager.prototype.draw_event = function()
{
$(this.root+'>tbody>tr>td>button.delete').click(function(){
notice_del($(this).parent().parent().children('td.td1').children(':checkbox').val());
});
};。。
function notice_del(notice_seq)
{
var UserInfoWin = window.open('http://gw.'+DOMAIN+'/hr/notice/delete/'+notice_seq,
'UserInfoWin',
'top=0,left=0,toolbar=0,directories=0,menubar=0,resizable=0,scrollbars=1,width=800,height=650');
UserInfoWin.focus();
}现在情况是点击delete按钮的话,相关项会被删除掉,但是会弹出新窗口,空白的。怎么才能不弹出新窗口,而直接删除。上面的notice_del函数就是弹出窗口的函数,但如果不执行这个,就不能到/hr/notice文件,并执行delete函数。这个/hr/notice/delete/ 是controller中的delete函数
本页面包含prototype.js的话,可以这个修改notice_del函数function notice_del(notice_seq)
{
new Ajax.Request({
'http://gw.'+DOMAIN+'/hr/notice/delete/'+notice_seq,
{
onSuccess: function () {
alert('删除成功');
},
onFailure': function () {
alert('删除失败');
}
}
});
}
这样做系统数据容易被恶意删除。建议修改。不能用的话很抱歉。
能用的话不用感激,捧捧场就行了
http://bbs.tongshulin.com有问题可以问我,免费解答。