Sunday, November 20, 2016

Re: Browser.getWindow().newXMLHttpRequest()

Did you fix it? It should work using 2.8.0, I just tested it again. If still not work, you better upload a project to github :).

On Thursday, November 17, 2016 at 11:32:30 AM UTC+1, P.G.Taboada wrote:
Thanks, this is what I was missing. 
I tried to use elemental, but could neither find formdata nor append...

I am having troubles with the event listeners:

final XMLHttpRequest xhr = Browser.getWindow().newXMLHttpRequest();
xhr.open("POST", "/upload");
xhr.setOnprogress(evt -> GWT.log("" + evt));
xhr.setOnabort(evt -> GWT.log("" + evt));
xhr.setOnerror(evt -> GWT.log("" + evt));
xhr.setOnreadystatechange(evt -> {
if (xhr.getReadyState() == XMLHttpRequest.DONE) {
try {
GWT.log("Received http response for request ");
String text = xhr.getResponseText();
if (text == null || text.isEmpty()) {
messageUi.setInnerText("no response");
} else {
messageUi.setInnerText(text);
}
} catch (Throwable e) {
GWT.log("Error", e);
}
}
});
final JsFormData formData = createFormData();
append(formData, "someFile", file);
xhr.send(formData);


I get 4 times

JsEventListener.java:42 Uncaught TypeError: this$static_0_g$.handleEvent is not a function

Any idea?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment