I am using jquery ajax for calling PHP
PHP
$response = array('isSuccessful'=> true , 'currentId'=> $currentId);
$response = json_encode($response);
echo $response;
Success() in ajax
success:function(data){
                var currentData=data;
                console.log(currentData);
                var s=currentData.currentId;
                console.log(s);
            }
Output is
{"isSuccessful":true,"currentId":13} 
undefined
What is the mistake i made.


1)Open the ajax url in browser and make sure it has only json string and no other extra characters.2)Use a content-type:json header in php3)Specify dataType as json in jquery request