Answer the question
In order to leave comments, you need to log in
Why var_dump($_POST); returns an empty array?
Here's what the browser returns to me:
With this JavaScript code:
$(function() {
var data = ($("#json").html());
console.log(data);
$.ajax({
type:'POST',
url: '../index.php',
data: {data: data},
success: function(){
alert('Успех!');
}
});
});
Answer the question
In order to leave comments, you need to log in
to start - var data = 10; and check if the value arrives. php code also does not hurt, otherwise guessing on logs without code does not work.
UPD: visually there are no errors in the code, it is difficult to say what specifically violates the script. How do you get, by the way, wardump, ajax then? in the parsing error network console? Try dumping $_REQUEST, nothing else comes to mind, except for non-obvious bugs, server settings and incorrect paths.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question