How to Use jquery to capture the Enter key and obtain the checkbox value and asynchronous request _ jquery-js tutorial

Source: Internet
Author: User
This article mainly introduces jquery's methods of capturing the carriage return key and obtaining the checkbox value and asynchronous request. The example analyzes jQuery's techniques for capturing the carriage return key, obtaining the checkbox value, and responding to asynchronous requests, for more information about how jquery captures the carriage return key and obtains the checkbox value and asynchronous request, see the following example. We will share this with you for your reference. The details are as follows:

1. jquery:

$ ("Html "). die (). live ("keydown", function (event) {if (event. keyCode = 13) {// here add the logic to be processed }});

2. jquery obtains multiple 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 ("operation successful! "); SubmitForm (null," initPage ");} else {alert (" operation failed! ");}}});

I hope this article will help you with jQuery programming.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.