I have a form, I want to change its path of action using js variable.
This is current working code:
if ($('#totalRecordsOfQuery').val() < 100) {
$('#postbackform').attr('action', "{{ path('_getAllRecordsStudentsProgress') }}");
$('#postbackform').submit();
$('#postbackform').attr('action', "{{ path('xyz) }}");
}
I want something like:
var allRecordsActions = "_getAllRecordsStudentsProgress";
if ($('#totalRecordsOfQuery').val() < 100) {
$('#postbackform').attr('action', "{{ path(allRecordsActions) }}");
$('#postbackform').submit();
$('#postbackform').attr('action', "{{ path('xyz') }}");
}
With this code, I'm getting an error:
Variable "allRecordsActions" does not exist.
or