how to get  json response in ajax?
<p>url : <code>http://localhost/test-mobile/log.php?username=&amp;password=pass</code></p>

<pre><code>$.ajax({
       url:url,
       type:'POST',
       data:{message:message},
       dataType:'json',
       json:'members',
       success:successData,
       error:function(){
        alert("error")
       }
      });
      function successData(data){
    var response=data.message;
    alert(response);
}
</code></pre>

<p>json response is <code>{"members":{"httpCode":"400","message":"Username missing"}}</code></p>

<p>PHP code is given below:</p>

<pre><code>&lt;?php
    require_once("class/clsdatabase.php"); //Connect to SQL 

$username = $_GET['username'];
$password = $_GET['password'];

    //Check Username
    if($username == '') {
        $user = 'Username missing';
        $success = true;
        $status = array("httpCode"=&gt;"400", "message"=&gt;$user);
        //return $status;
    }

    //Check Password
    if($password == '') {
        $pass = 'Password missing';
        $success = true;
    }


    //Create SELECT query
    $qry = "select * from user_register where emp_code='$username' AND emp_password='$password' AND active='1';";

    $result = mysql_query($qry);
    $te = mysql_num_rows($result);

    if($te == 0 &amp;&amp; $username != '' &amp;&amp; $password != '') {
        $both = 'Invalid username or password';
        $success = true;
    }


    //If there are input validations, redirect back to the registration form
    if($te != 0 &amp;&amp; $username != '' &amp;&amp; $password != '') {

        $row = mysql_fetch_assoc($result);
        $name = $row['emp_code'];
        $success = true;
        $status = array("httpCode"=&gt;"400", "message"=&gt;$name);
        //return $status;
    }

//echo $_GET['callback']. '(' . json_encode($status) . ');';    
echo '{"members":'.json_encode($status).'}';

?&gt;
</code></pre>

<p>alert a json response</p>
