• 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

Make certain characters of a word from string bold

Laravel SQL query midnight time not showing

Add Class in html Dynamically in PHP

Combine multiple columns into an array as one of the key in a results set

Form Validation and Submission to database

I can't delete my image when it is liked because of the foreign key in mysql

Laravel passport auth token not working after moving to different server

How to change product Image when variables are selected in Shop and Archive Pages?

How can I make Laravel return a custom error for a JSON REST API

How to identify whether webp image is static or animated?

PHP Array split string and Integers

Laravel Mix Uncaught ReferenceError: $ is not defined

How can I get user id from session in javascript?

Best way to scrolldown onpageload

Laravel Carbon throws error The format separator does not match

About Contact Privacy policy Terms and conditions