• 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

php curl_exec() Connection refused when retrieving a remote image

How to pass data to all views in Laravel 5?

How to get an Array value inside an object in an array Php [duplicate]

Remove country code from phone number?

How do I Post to .txt document before form submits

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

How to get page number on dompdf PDF when using "view"

Send Outlook 2010 email using PHP

Only on Firefox "Loading failed for the <script> with source"

How to set a domain name with php artisan serve

Reducing authentication calls on external API (Laravel 5.6)

Store / Website Column in Magento 2 Admin Grid - Custom Module

Insert multidimensional array to codeigniter cart

Why does using salted hash on python and php give me different results?

Combine array with same value and add other [duplicate]

About Contact Privacy policy Terms and conditions