Home >Web Front-end >JS Tutorial >jquery's method of capturing the enter key and getting the checkbox value and asynchronous request_jquery
The example in this article describes how jquery captures the enter key and obtains the checkbox value and asynchronous requests. Share it with everyone for your reference, the details are as follows:
1. jquery captures the Enter key:
$("html").die().live("keydown",function(event){ if(event.keyCode==13){ //这里添加要处理的逻辑 } });
2.jquery gets multiple selected checkbox values:
$('input[type="checkbox"][name="types"]:checked').each(function() { types = types+$(this).val()+ "|"; } );
3.jquery asynchronous request method:
$.ajax({ url : "${pageContext.request.contextPath}/UOSRoleManangerAction.do?method=createRole", type : "post", dataType : "html", data:{"roleName":roleName,"roleDescription":roleDescription,"roles":roles,"types":types}, success : function(data){ var dataObj=eval("("+data+")"); if(dataObj.result){ alert("操作成功!"); submitForm(null,"initPage"); }else { alert("操作失败!"); } } });
I hope this article will be helpful to everyone in jQuery programming.