if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
$name = $_POST['texts'];
echo $name;
}
else {
//index code
}
if(isset($_GET['context']))
{
if($_GET['context'] == 'ajax')
/*....*/
}