未定义的索引:处理此AJAX代码时的名称

$(document).ready(function(){
    $('#add').click(function (e) {
        e.preventDefault();
        var inputdata = $('#iname').val();
        $.ajax({
            type: "POST",
            url: "get.php",
            data: inputdata,
            success: function (data) {
                alert("data" + data)
            }
        });
    });
});

This Code Shows the Error Undefined index : name. This is My form method. add This is Get.php Code :

<?php
    $name = $_POST['name'];
    echo $name;
?>

you have to set key and value inside data variable object name : inputdata

$(document).ready(function(){
    $('#add').click(function (e) {
        e.preventDefault();
        var inputdata = $('#iname').val();
        $.ajax({
            type: "POST",
            url: "get.php",
            data: {
                name : inputdata
            },
            success: function (data) {
            alert("data" + data)
            }
        });
    });
});

Finally i have found the Solution but not the reason this is due to .htaccess file. i have created. in my application after removed the file working fine without any issues.. i don't know why this happen if you know please solve this

#Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]

#error documment..
Options -Indexes
ErrorDocument 403 http://localhost/error/403