Phillip
Posts: 0
Joined: Sun Mar 30, 2014 2:15 pm

XMLHttpRequest

Hello,
I cannot get XMLHttpRequest to work in my application using JavaScript. The snippet of code below works fine in a PC browser but does not work in Appery.IO

Are their any special config files, server permissions that I need to provide? I can browse to the XML file from my PC. But it does not seem to work within Appery.

Thanks

  • Phillip

    alert("Begin XMLHttpRequest");
    var xhr;
    xhr = new XMLHttpRequest();
    xhr.open('GET', 'http://www.w3projects.com/RSS/ALT001....);
    //^^ Call does not work in Appery ^^//
    xhr.send();
    alert("xhr response " + xhr.responseXML);
    alert("xhr ready state " + xhr.readyState);
    var xmlDoc;
    xmlDoc = xhr.responseXML;

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

XMLHttpRequest

Hi Phillip,

Are there any console errors?
You could use REST services:
http://devcenter.appery.io/documentat...

Phillip
Posts: 0
Joined: Sun Mar 30, 2014 2:15 pm

XMLHttpRequest

No console errors (within the JavaScript editor) When I run the application I get the initial alert (Begin XMLHttpRequest) then it has some type of silent error on the xhr.open. trying to figure out why it's not working.

I may use the REST Services, but hoping to get this simple XMLHttpRequest to work. Any ideas?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

XMLHttpRequest

Hi Phillip,

What error do you get when running this service? If it is in cross-domain call (http://devcenter.appery.io/documentat...) it's better to use Appery.io proxy (http://devcenter.appery.io/documentat...).

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

XMLHttpRequest

Hi There,

I hv got the same error returned.
the msg is "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience".
any advice ?

Thk you,
Eric

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

XMLHttpRequest

Hi Eric - Where exactly you are calling XMLHttpRequest in your app? Is it possible to provide us such example for testing?

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

XMLHttpRequest

Hi Illya, thk you for your prompt feedback over the weekend.

It seems I found the missing part in the server code.

Forget about this question for the moment.

Best,
Eric

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

XMLHttpRequest

Illya, hi again, it works well now. sorry for the inconvenience. enjoy your wknd. Eric

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

XMLHttpRequest

Thank you for the update, Eric! Glad its working now, I'm curious what was the problem?

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

XMLHttpRequest

my first code was:

var trialOK;
[... some code ...]
response.success(trialOK);

server code's console did provide the expected response, as well as the service's test.
however, I missed the error red dot nxt the expected response on the test console which blocked the mapping and generated the error msg.

proper code is:

response.success(JSON.stringify({
trialPeriod: trialOK
}), "application/json");

my mistake :)

Return to “Issues”