AJAX data not passed to php correctly only in Internet Explorer

AJAX data not passed to php correctly only in Internet Explorer

Hi All

I have js file which is calling a php file. following is the code.

$.ajax({
    type: "POST",
    url: "user.php",   
        data: {username : username.val(),password : password.val()},
    success: function(result) {                     
        if (result==0)
        {  
            //displayerror;
        }
        else
        {
             location.reload(true);
        }
    }
});  
in user.php file I'm assign variables as follows,

$username =$_POST['username'];
$password =$_POST['password'];
When browsing using Internet Explorer 11 it is giving an error "Notice Undefined index username".

When I check POST values in php file using

var_dump($_POST);
it is returning array(0){}. I also checked js file's passing data object. It contains correct values as expected.

Above code is working fine in Firefox as well as in the Chrome.

Does any one have an idea what's wrong in IE?

Thank you