You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by Lenin <le...@gmail.com> on 2012/08/08 06:30:17 UTC

issue with jquery client

how to send the response to jquery client as josn data.
this is my jquery code for getting data to client 

 *var url=
'http://10.163.14.56:9000/customerservice/renderdetails?callback=?';
              
              $(document).ready(function(){
                        $('#getData').click(function() { 
                        $.ajax({
                            type: 'GET',
                                url: url,
                                async: false,
                                crossDomain:true,
                            jsonpCallback: 'jsonCallback',
                            contentType: "application/json",
                            dataType: 'jsonp',
                            success: function(json) {
                            alert("success") ;
                            alert(json.name);
//                            console.dir(json.sites);

                                },
                                error: function(e) {
                                    alert("error"+e.toString());
                                }
                            });
});
});*


i have used jax-rs 2.6.1 framework in restfull for server side code

 *@GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/renderdetails")
    public Response get_Det(){
//        String json ="{symbol: 'IBM', price: 91.42}";
         String data="{"
	+"\"age\":100,"
	+"\"name\":\"otcnic\" "
+"}";
         System.out.println("JSON Data:"+data);
        return Response.ok(data, MediaType.APPLICATION_JSON).build();

    }*

 please let me know what i made mistake,
i am getting the following in client side :
error[object Object]

Timestamp: 08/08/2012 09:58:02 AM
Error: SyntaxError: invalid label
Source File:
http://10.163.14.56:9000/customerservice/renderdetails?callback=jsonCallback&_=1344400082000
Line: 1, Column: 1
Source Code:
{"age":100,"name":"otcnic" }

if any body having server side and cient side code......
please share it....
it would be help for me........
thanks in advance

G.Lenin
Research Scientist
OTC-NIC





--
View this message in context: http://cxf.547215.n5.nabble.com/issue-with-jquery-client-tp5712166.html
Sent from the cxf-issues mailing list archive at Nabble.com.