• 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

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

Open a popup box after receiving result from ajax

SQL to convert multiple rows into a single row of variable length

PHP drop down list using array's and foreach (else and for) code

Redis Command To Sort Keys

find in set in laravel ? example

VichUploaderBundle error "Expected argument of type "File", "NULL" given" when submitting the form without selecting any file

how to see if database exists with PDO [duplicate]

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

PHPUnit (Phar) Fatal Error Only When Test Fails

RabbitMQ PRECONDITION_FAILED - unknown delivery tag

Confirm Leave on External Links in Wordpress

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

Add rows to Single product Additional information table in WooCommerce 3.6

Why rand() every time I refresh the page?

About Contact Privacy policy Terms and conditions