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
JQuery on() method, combine multi class and event handlers

I am looking one solution for combine multi selectors and different event handlers for execute my funcion.

My question: i have a form with all data that pass to php by ajax. Now i send it by submit input, and .on 'submit' event, but i need execute it also by another event click with another class, example an checkbox.

Inside form have class .formdataaj and inside an checkbox called .checkbox_ajx (i use it like switch for pass var 1 or 0 to php, activate or disactivate my posts)

my code:

$('.formdataaj').each(function(){
        $(this).on('submit',function(e){
        var className=$(this);
        e.preventDefault();
        var form_data = new FormData(this);
        //console.log(...form_data);
        $.ajax({
            type: 'post',
            url: 'php/extra_update.php',
            data: form_data,
            processData:false,
            contentType:false,
            cache: false,
            success: function(data)
            {
                console.log(data);
                
                //get parse json data
                var jsondata = $.parseJSON(data);
                console.log(jsondata);
                
            }

        })
        
    })
    })

Thank you

about 4 years ago · Juan Pablo Isaza
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!