I am sending this variable to other page, to make a validation.
However print_r($_POST);
only show Array ()
.
Normally we use serialize, is sent the name attribute, but in this case only is sent the variable with the text. So something like $form = $_POST['data'];
only works to
in firebug:
data="something"
but in my case i just send
something
code
<?php $page = "someText"; ?>
JS
default:
$("#msg").fadeTo(200, 0.1, function() {
$(this).html('success').fadeTo(900, 1);
$.ajax({
url: "page_validation.php",
type: "post",
dataType: "json",
data:'<?php echo $page; ?>',
success: function(data) {
$('#one').load('page.php');
}
});
});
break;
try it like
$page = "someText";
$.ajax({
url: "page_validation.php",
type: "post",
dataType: "json",
data:"postedvariable=<?php echo $page; ?>",
success: function(data) {
$('#one').load('page.php');
}
});
and acces the varible in page_validation.php as $_POST['postedvariable']
also another option will be to use
$.post("page_validation.php",
{postedvariable:'<?php echo $page; ?>'},
function(data) {
$('#one').load('page.php');
});
whic looks even simpler than the $.ajax