How to pass extraparameter using jQuery.submit() ?.
if you see this: https://api.jquery.com/submit/
you will see submit function accept eventdata argument, but how to make eventlistener grab this data?
Note: I dont want the handler to be put inside the submit function like: .submit( [eventData ], handler )
This is not working:
<form id="form1">
<button type="submit" id="button1">Click here to test</button>
<input type="text" value="123">
</form>
<script>
$(function() {
$('#button1').on('click', function(e) {
$('form#form1').submit({"url": "url"});
});
$("form#form1").on("submit", function(event,data){
console.log(event);
console.log(data); //this is not exist. why?
return false;
});
});
</script>