
$(document).ready(function(){
	$("#searchBtn").bind("click",function(){
		reg.search();
	});
	
	
})

var reg = {

	remove : function(id, param){
		bootbox.confirm({
			buttons: {
				cancel: {
					label: '取消',
					className: 'btn-default'
				},
				confirm: {
					label: '确认',
					className: 'btn-myStyle'
				}
				
			},
			message: '请确认是否删除?',
			callback: function(result) {
				if(result) {
					$.ajax({
						  type: 'GET',
						  url: webPath + '/api/activity/reg/del?'+ param +'='+id,
						  dataType:'json',
						  success: function(data){
							  window.location.reload();
						  }
					})
				} else {
					
				}
			},
			title: "删除报名人"
		    });
	},
	search : function(){
		var activityId = $("#activityId").val();
		var searchStr = $("#searchStr").val();
		var url = webPath + "/activity/reg/list";
		
		if(activityId!="" || searchStr!=""){
			var param = "?"
			if (activityId != ""){
				param = param + "activityId=" + activityId ;
			}
			
			if (searchStr != ""){
				if (param == "?"){
					param = param + "searchStr=" + searchStr;
				} else {
					param = param + "&searchStr=" + searchStr;
				}
				
			}
			url = url + param;
		}
		window.location.href = url;
	}
	
}


















