2
The server sends a JSON, normal. Follows the code:
@GET
@Path("email")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public String getEmail(){
    ViewStatisticsEmail statisticsEmail = new ViewStatisticsEmail();
    statisticsEmail.setDoacoes(1432);
    statisticsEmail.setLidas(5443);
    statisticsEmail.setNaoLidas(4667);
    statisticsEmail.setSent(10000);
    statisticsEmail.setVisualization("Atualizado por ultimo " + Calendar.getInstance().getTime());
    return new Gson().toJson(statisticsEmail);
}
And I’m using ajax to draw a graph with this information. Follow the code of ajax:
function chartEmail() {
    var url = 'http://192.168.0.42:8080/Admin/service/email';
    $.ajax({
        type: 'GET',
        url: url,
        dataType: 'jsonp',
        success: function (data) {
            var data = google.visualization.arrayToDataTable([
                ['Task', 'valores'],
                ['Lidas',     data.lidas],
                ['Não lidas',      data.naoLidas],
                ['Doações',  data.doacoes]
            ]);
            var options = {
                title : data.sent,
                legend : "bottom",
                pieHole: 0.4
            };
            var chart = new google.visualization.PieChart(document.getElementById('chart-email'));
            chart.draw(data, options);
        }
    });
  }
It is the google Harts.
Here comes the following mistake: Uncaught SyntaxError: Unexpected token:

Why
jsonp? This looks like a normal JSON... (no padding)– Sergio
So... that’s the problem, if I put normal json it gives "no Access control allow origin
– Renato Vieira Dantas
This is because the server does not allow external connections. The server and this page are in fact domain?
– Sergio
Sergio is localhost the two... plus and testing, when going to production will no longer be... as I do for the server enable external connections?
– Renato Vieira Dantas
If you change your jsonp for json, that answer here help you?
– Victor Stafusa
gave another error SERIOUS: Servlet.service() for Servlet [Jersey REST Service] in context with path [/Admin] threw Exception [Servlet Execution threw an Exception] with root cause
– Renato Vieira Dantas
In Java I can not help much, but you can take a look here: http://www.codingpedia.org/ama/how-to-add-cors-support-on-the-server-side-in-java-with-jersey/ and surely someone will come to help in this. However developing uses addresses without
http://192.168.0.42:8080, that is relative. This makes the browser realize that ajax is local and no longer blocks withAccess control allow origin– Sergio
with jsop it does and receives the response of the request, just can’t read it, as you can see there in the print I sent, it breaks in two points...
– Renato Vieira Dantas