I am trying to display the number of rows of the table. In the controller, I have a function like:

```
public function index(){
  $count= $moviecount = $this->Media->find('count');
  $this->set(array('data' => $count, '_serialize' => 'data'));
}

```

In my index.ctp, I have a regular HTML script with divs and everything. Here in my JavaScript file, I do something like this. 

```
function checkTbl(){
checkBrowser();//callback function
xmlhttprequestobject.open("GET", "/url/", false); //async
xmlhttprequestobject.onreadystatechange = function(){
if(xmlhttprequestobject.readyState==4 && xmlhttprequestobject.status==200){
  alert(xmlhttprequestobject.responseText);
}
}
xmlhttprequestobject.send();
}

```

but when I click the image event onClick, the response is HTML, not the integer value of the count. please help.