I have the following event on a check box in CoffeeScript:
$('#check_box').click ->
opts =
target: '#project_total'
beforeSubmit: preSubmit
success: postSubmit
$('form').ajaxSubmit(opts)
preSubmit = ->
$('input#running').remove()
$('<input/>').attr('type', 'hidden').attr('id', 'running').attr('name', 'running').attr('value', 'true').appendTo('form')
But the input element, #running, is not sent as part of the ajaxSubmit call. All other form values are sent. If I click the check box, then click the Submit button, the #running value is sent.
How can I send the value of #running along with the ajaxSubmit() call?
If you want to send an hidden element with a form, you should use a Type="Hidden" in the input you want to send aswell. In this case your running should look something like
<input id="running" type="hidden" value="somevalue"/>
and it should be sent along with the whole form.
This code is a bit confusing, why do you actually remove input#running and then create it afterward?