php - why can't we access values on server side in POST request? -
i tried send request jquery ajax contenttype 'text/plain'. unable access values on server side. accessing values using $_post array in php file. why happening.
jquery ajax code:
$.ajax({ type: "post", data: {o_pass:o_pass,n_pass:n_pass}, url: "changepass", success: function(response) { alert(response); } });
server side:
$old_pass = $_post['o_pass']; $new_pass = $_post['n_pass'];
because post
requests should have content type of application/x-www-form-urlencoded
or multipart/form-data
server knows dealing with.
what reason sending request plain text?
Comments
Post a Comment