Why can't I get my JSON Data posted using AJAX in my PHP file?
The problem is that dataType: "json"
doesn't mean that you're posting json, but that you're expecting to receive json data from the server as a result of your request. You could change your post data to:
data: {myPostData : "{'lastName':'" + _lname + "','firstName':'" + _fname + "','middleName':'" + _mname + "'}"}
and then parse it on your server like
$myPostData = json_decode($_POST['myPostData']);$firstname = $myPostData["firstName"];$lastname = $myPostData["lastName"];$middlename = $myPostData["middleName"];