Jquerypost: how to pass the array method and code _ jquery

Source: Internet
Author: User
If Jquerypost transmits Arrays for batch deletion, an array of data IDs to be deleted is required. The following is the specific implementation code, if you are interested, you can refer to the following example to delete data in batches. To delete data in batches, you will need to pass the data ID array to be deleted.

The Code is as follows:


Function RemoveLog (){
Var postModel = [];
// Retrieve the ID of the data to be deleted and store it in the array.
$ ("[Name = 'lid']"). each (function (){
If ($ (this). attr ("checked") = "checked ")
PostModel. push ({name: 'kids', value: $ (this). val ()});
});
If (postModel. length = 0 ){
Alert ('select the content to delete first! ');
Return;
}
// Post Deletion method, passing an array
$. Post ('/admin/delete', postModel, function (data ){
});
}


The Code is as follows:


// C # Use the corresponding List collection class in the background to receive data.
Public JsonResult Delete (List Ids)
{
}

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.