**ajaxcheck.js** 

```
var val = "hai";

 $.ajax(
 {
 type: 'POST',
 url: 'ajaxphp.php',
 data: { "abc" : val },

success :function(data)
 {
    alert('success'); 
 }

 }

 )
.done(function(data) { 
alert("success :"+data.slice(0, 100));

 }

 )
.fail(function() { 

alert("error"); 

}
);

```

**ajax.html**

```
 <!DOCTYPE html >

 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
 </script>

  <script type="text/javascript" src="ajaxcheck.js"></script>

  <title>ajax request testing</title>
  </head>

  <body>
  </body>
  </html> 

```

**ajaxphp.php** 

```
<?php

$v_var = $_POST["abc"];

print_r($_POST);

if(isset($_POST["abc"]))
{
echo $v_var;
}
else
{
echo "Data not received";
}
?>

```

When I run the ajax.html file ,I get success alert. But when I run ajaxphp.php file it shows notice like: 

```
undefined index abc 

```

Why is that the data is not received in `$v_var` ? where i am mistaking ?please help.