单选框动态赋值
$('input[name=pszt][value='+val+']').attr("checked",true);
置顶的几种方式
window.scrollTo(0,0)
document.getElementById("id").scrollIntoView();
通过window.location.href下载文件 解决url 传参中文乱码
window.location.href = encodeURI(url)
ajax 添加headers 以及更改contentType
$.post({
url: apiAddress + "api",
dataType: "json",
data: submitData,
headers: {
'X-XSRF-TOKEN': $.cookie('XSRF-TOKEN')
},
contentType: "application/json;charset=UTF-8",
success: function (data, msg) {
},
error: function () {
alert('error')
}
});