• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Send same name multiple checkbox values via ajax

javascriptphpjqueryajax


PHP Snippet 1:

var checked = [];
$("input[name='userpages[]']:checked").each(function ()
{
    checked.push(parseInt($(this).val()));
});

PHP Snippet 2:

var data = []

$('input[name="userpages[]"').each (function (index, element) {
    data[$(element).attr('id')] = $(element).val();
});
console.log(data);

Related Snippets

WooCommerce - unset "<product> removed notice…" on cart page

how to retrieve the first and last instance of a row in pdo dataset

How do I enable error reporting in Laravel?

Pages are working fine on localhost but not running on the hosting server

PHPMetrics option --excluded-dirs="myfolder" : myfolder dir is not excluded within docker

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

How can I create a Download Page with post php method?

PhpSpreadSheet: How to save Workbook sheets in individual CSV files

Redis Command To Sort Keys

Add a custom text for a particular product on specific email notification in Woocommerce

Prevent blank space in pdf pages (DomPdf)

How to get monthly wise data in laravel

How to downgrade or install a specific version of Composer?

I cannot create a auto generated date time in mysql workbench

How to use PHPCBF to fix one issue at a time?

About Contact Privacy policy Terms and conditions