Friday, 24 June 2016

javascript - Why is Ajax not returning any data?

Below is my Ajax request. When something is changed in the form standard_filter, such as a checkbox being clicked, the function is triggered. It all seems to work fine, the data is even passed on as can be seen in the image. After done() however, the data just seems to be empty? I can't figure out why, when I log the result it is simply [object object], any idea what the problem could be?






$('.standard_filter').on('change', function(e) {
var form = $('.standard_filter');
var inputId = e.target.getAttribute('id');
var inputName = e.target.getAttribute('name');
var inputValue = e.target.getAttribute('value');
var inputLabel = $(e.target).next("label").text();
alert(inputName);

$.ajax({
url : form.attr('action'),
method : form.attr('method'),
dataType : 'jsonp';
data : {
id : inputId,
name : inputName,
value : inputValue,
label : inputLabel
},

}).done(function(data){
//do the filter
// show the filters
$('.ctlg_active_filters').addClass('active');
alert(data);
});
});






below are screenshots of the resonse:



enter image description here
enter image description here

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...