Hi all,
I am trying to use JSON to get data from a php server. Here is my
code :
String url =
"authenticate.php?name=\'"+name"\'&pwd=\'"+pass+"\'";
System.out.println(url);
RequestBuilder requestBuilder = new
RequestBuilder( RequestBuilder.GET, url );
try {
requestBuilder.sendRequest( null, new RequestCallback(){
public void onError(Request request, Throwable
exception) {
System.out.println("Unable to make the
query "+ request);
}
public void onResponseReceived(Request request,
Response
response){
System.out.println(response.getText());
final JSONValue jsVal =
JSONParser.parse(response.getText());
final JSONArray jsonNews =
jsVal.isObject().get("item").isArray();
if(!jsonNews.isArray().get(0).isObject().equals(null)){
this.init();
}else{
Window.alert("error");
}
}
} );
} catch (RequestException e) {
System.out.println(e.toString());
}
My problem is, I have my complete php script as "response" when
onResponseReceived(...) is fired.
However, when I paste the url that I get in the console, the result is
exactly what I want :
{"item":[{"name":"usernameTest"}]}
Any idea ?
I am using gwt1.5.2 with a jre 1.6
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---