$(document).ready(function(){
	$("input[name=selectbutton]").click(function (e) {
		var url="exam.php?eid="+$('#examlist option:selected').val()+"&sid="+$('#examsection option:selected').val();
		window.open(url);
	});

	$('#examlist').change(function(e) {
		$.ajax({
		  type: "POST",
		  url: "ax/index.php",
		  data: "examid="+$(this).val(),
		  dataType:"html",
		  success: function(data){
			  if(data!=null)
			  {
				setions=data.split(",");
				setions.sort(function(a,b){return a - b})
				$('#examsection').children().remove();
				$('#examsection').append('<option id="">选择</option>');
				$('#examsection').focus();
				for(var k=0;k<setions.length;k++)
				{
					key=setions[k];
					if(key!=null && key!= "" && key!="undefined")
					{
				 		$('#examsection').append(
						$("<option value='"+key+"' >"+key+"</option>")	
						); 
					}
				}
			}
		}
		});
	});

});


