I am struggling with this.
I am trying to pass element data to my php file using $.ajax and it always returns empty.
Here is my code:
strJson = '{'
$.each(this_side.data(), function(i, v) {
strJson += i + ":'" + v + "',";
});
strJson += term_id + ":'" + term_id + "',";
strJson += new_page_num + ":'" + new_page_num + "'";
strJson += '}';
alert(strJson); // this works
$.ajax({
url: 'my url here',
type: 'post',
data: strJson,
success: function(data){
alert(data);
}
});
Outpot of $_POST is an empty array. It's not working.
What I am missing here please???
done, notsuccess. api.jquery.com/deferred.doneitoo:strJson += "'"+ i + "':'" + v + "',";data : JSON.parse(strJson),