script not showing any alert
<p>here i am supposed to call a web service in php and the return json of the web service is stored in  a variable called $response,then i am passing that json to javascript ,here i am parsing the json and depending on the type of the employee and each type have differebt attributes i am  alerting all ,when i have did the same function in another page for testing it was working where i have given value to var txt='' by hardcoding , when i have integrated the php web service with the one i havew tried nothing is having ,i am confused there is no error showing with javascript console.</p>

<pre><code> &lt;?php
session_start();
$regid=$_SESSION['product_registration_id'];
//echo $regid;
$details=array(
'product_registration_id'=&gt; "$regid");
//coverting the vlaues collected from form into json
//calling the web service
$url='webservice url';
    $data=$details;
    $ch=curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($details));
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
    $response= curl_exec($ch);
    echo ("The Server Response is:" .$response);
    curl_close($ch);
    json_decode($response);
    $json_a=json_decode($response,true);
    echo $json_a[expired];
    echo $json_a[account_detail][0];
 ?&gt;
&lt;/div&gt;
    &lt;script&gt;

var txt = '&lt;?php echo $response ?&gt;';
alert(txt);
//var jsonData = eval ("(" + txt + ")");
var jsonData = JSON.parse(txt);
for (var i = 0; i &lt; jsonData.employees.length; i++) {
var counter = jsonData.employees[i];
//console.log(counter.counter_name);
alert(counter.type);
if(counter.type=="0")
    {
      alert(counter.building_name);
      alert(counter.org_name);
      alert(counter.user_name);
      alert(counter.name);
      alert(counter.loc_name);
      alert(counter.email_id);
      alert(counter.password);
    }
if(counter.type=="1")
    {
        alert(counter.user_name);
        alert(counter.name);
        alert(counter.password);
        alert(counter.email_id);
    }
    if(counter.type=="2")
        {
            alert(counter.building_name);
            alert(counter.org_name);
            alert(counter.user_name);
            alert(counter.opr_code);
            alert(counter.name);
            alert(counter.loc_name);
            alert(counter.email_id);
            alert(counter.password);
        }
        if(counter.type=="3")
            {
               alert(counter.building_name);
               alert(counter.org_name);
               alert(counter.machine_type);
               alert(counter.activate_status);
               alert(counter.machine_name);
               alert(counter.entrance_exit_name);
               alert(counter.entrance_or_exit);
               alert(counter.loc_name);
               alert(counter.activation_code);
            }
}

&lt;/script&gt;
</code></pre>
