Answer the question
In order to leave comments, you need to log in
Ajax request fields not being sent?
I'm trying to send an ajax request:
;(function($, undefined){
$(document).on('click', 'a.ajax', function () {
$.ajax({
url: '{{ path('infrastructure_shift_ajax') }}',
type: "POST",
datatype: "json",
data: {
"some_var": "some_value",
"employeeId": this.employeeId,
"day": this.day,
},
async: true,
success: function (data) {
alert(data + " has been sent");
}
});
return false;
})
})(jQuery);
{% for employee in employees %}
<tr>
<td style="min-width: 10px">{{ employee }}</td>
{% for day in 1..31 %}
<td style="min-width: 10px">
<a class="ajax" href="#">{{ employee }}</a>
</td>
{% endfor %}
</tr>
{% endfor %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question