Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
manipulando SerializeArray en jquery

Hola chicos, he estado tratando de usar javascript/jquery para obtener una matriz de nombres y valores de un elemento. He usado la función serialize Array, funciona bien, pero necesito más que eso, consulte el código a continuación.

 $(document).ready(function(){ var maps = {}; $("#submitt").click(function(){ var x = $("#details").serializeArray(); // x.push({"name" : "event_id", "value" : 22}); console.log(x); }); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <form action="" id = "details"> <div class = "general" name = 'GENERAL'> <input type="checkbox" name ="email"> <input type="checkbox" name ="phone"> <input type="checkbox" name ="push"> </div> <div class = "general" name = 'MEETING'> <input type="checkbox" name ="email"> <input type="checkbox" name ="phone"> <input type="checkbox" name ="push"> </div> </form> <button type = "submit" id= "submitt">submit</button>

devuelve todas las entradas sin ninguna identificación. Necesito que sea como:

 { GENERAL : { email : on, phone : on, push : on }, MEETING : { email : on, phone : on, push : on }

como una matriz multidimensional en php. ¿Hay alguna otra manera de obtener los resultados requeridos? Por favor, ayúdame.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

solo intente como el siguiente código <input type="checkbox" name ="GENERAL[email]">

 <form action="" id = "details"> <div class = "general" > <input type="checkbox" name ="GENERAL[email]"> <input type="checkbox" name ="GENERAL[phone]"> <input type="checkbox" name ="GENERAL[push]"> </div> <div class = "general" > <input type="checkbox" name ="MEETING[email]"> <input type="checkbox" name ="MEETING[phone]"> <input type="checkbox" name ="MEETING[push]"> </div> <button type = "submit" id= "submitt">submit</button> </form>```
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!