I have this piece of code:

```
$.ajax({
url: '/piece.json',
type: "GET",
dataType: "json",
success: function (data) {
    alert(data);
}
});

```

I am on a rail3 app, when I type "/piece.json" I get on my browser what I want. But I cant make it alert using Javascript! Why this happens?

Solved, had to use this:

```
complete: function (data_response) {

    alert(data_response.responseText);
},

```