加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ajax回调有参的函数

发布时间:2020-12-16 02:00:58 所属栏目:百科 来源:网络整理
导读:搞52lz会员管理,跟进记录提交成功后刷新某个div,我写成: form action="/weihu/site/coinsmgr/addviplog.xhtml" class="pageForm required-validate" onsubmit="return validateCallback(this,refreshFollowLogs(${info.loginType},${info.userId}));" metho
搞52lz会员管理,跟进记录提交成功后刷新某个div,我写成:
<form action="/weihu/site/coinsmgr/addviplog.xhtml" class="pageForm required-validate" onsubmit="return validateCallback(this,refreshFollowLogs(${info.loginType},${info.userId}));" method="post">

结果先执行refreshFollowLogs,然后再执行action,因为refreshFollowLogs()就是一个执行结果。所以改成

<form action="/weihu/site/coinsmgr/addviplog.xhtml" class="pageForm required-validate" onsubmit="return validateCallback(this,refreshFollowLogs);" method="post">



就OK了,但我要传递的参数怎么办?
1.搞成全局变量
2.把onsubmit="return validateCallback(this,refreshFollowLogs);"里的 refreshFollowLogs改成匿名函数。
3.把参数写到 refreshFollowLogs函数里。
我用第三种:
function refreshFollowLogs(){
	var lType=${info.loginType},uId=${info.userId}
	$("#table-vipLogs").ajaxUrl({
		type:"GET",url:"/weihu/site/coinsmgr/vip/loglist.xhtml?loginType="+lType+"&userId="+uId,callback:function(){
			//$("#infoAdminSearch0-boxId").find("[layoutH]").layoutH();
		}
	});
	return false;
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读