Pass extra variable when submitting a form using jQuery

前端 未结 5 2153
野性不改
野性不改 2021-02-12 12:53

I have a form in which the Submit button does not sit within the

tags. The submit button has an click handler to submit the form via jQuer
5条回答
  •  别那么骄傲
    2021-02-12 13:27

    On jquery 1.11.1

    I've managed it like that:

    $(yourForm).on('submit',{'yourExtraData':extraData},function(event){
            alert('your extra data ' + event.data['yourExtraData'] + ' went thru');
    });
    

    Check also: https://api.jquery.com/event.data/

提交回复
热议问题