First of all, I think you have mistakenly mixed PHP and JavaScript. In your code the line:
$something = "text";
may be understood in two ways. If this is the whole code you have, then you are actually initializing JavaScript variable called $something. Later in the code you are trying to use the value of PHP variable called $something.
What you need to do is to change the code into (assuming you want to pass variable from PHP):
<?php $something = "text"; ?>
$.ajax({
url: 'page.php',
type: 'post',
dataType: 'html',
data: '<? php $something; ?>',
success: function (data) {
$('#total').load('xxx.php');
}
});
or into (assuming you want JS variable):
var $something = 'text';
$.ajax({
url: 'page.php',
type: 'post',
dataType: 'html',
data: $something,
success: function (data) {
$('#total').load('xxx.php');
}
});