Here is the javascript part of the code;
$.ajax
({
type: 'POST',
url: location.href,
data: {
'uploaded_data' : 'uploaded_data',
},
dataType: 'text',
success: function(message) {},
complete: function(message)
{
alert(message);
}
});
And here is the php part;
if(isset($_POST["uploaded_data"]))
{
$text="test text";
echo $text;
exit();
}
For some reason alert message shows [object Object] message instead of "test text". And the weird thing is if I try it like this;
alert(JSON.stringify(message));
it alerts this message;
{"readyState":"4", "responseText":"test text","status":200,"statusText":"OK"}