Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

connect to mysql database

Could you check if it works with any other REST client? Please also check if it works in browser?

Koning Voetbal
Posts: 0
Joined: Thu Feb 27, 2014 2:21 pm

connect to mysql database

Hello,

I have checked it in the Chrome Advanced REST Client App where I got the response I expected.

Image

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

connect to mysql database

Try using content-type=x-www-form-urlencoded in Appery.io

Koning Voetbal
Posts: 0
Joined: Thu Feb 27, 2014 2:21 pm

connect to mysql database

Yep, that did the trick !!

Tnx for clearing this out for me.

Koning Voetbal
Posts: 0
Joined: Thu Feb 27, 2014 2:21 pm

connect to mysql database

Just one more question ........... ;-)

I got in the test tab the following response:

{
"error":true,
"message":"Sorry, this email already existed"
}

How can I get this error into the app?

I read that I must add the following Javascript on the service Error callback:

var response = JSON.parse(jqXHR.responseText);
alert(response.description);

But I can't find the service Error callback .....

Where exactly can I find this so I can add the Javascript?

I try to set this in the Pages -- Add event -- Select the component and give this the event Error but this seems not be the solution ....

Kind regards,

Arie

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

connect to mysql database

Hello!

You can use this code in any JS event handler.

For example on button click:

See details: http://prntscr.com/4jeenb/direct

It's best way to understand how to work with this tool to pass this tutorial: http://devcenter.appery.io/tutorials/...

Koning Voetbal
Posts: 0
Joined: Thu Feb 27, 2014 2:21 pm

connect to mysql database

Hello, I got an NaN error when setting this one like the image you give me.

But I think it isn ́t really what I want, this solution isn ́t giving me the response of the signup services.

In http://www.wijhoudenvanvoetbal.nl/app... there are some standard error response such as ́email already exist ́ or ́you must fill this field ́

When I go to the Test tab in the service http://www.wijhoudenvanvoetbal.nl/app... I get this response if I don't fill in anything, just hitting the submit button:

{
"status":"400 Bad Request",
"url":"http://www.wijhoudenvanvoetbal.nl/app...",
"response":{
"error":true,
"message":"Required field(s) name, email, password is missing or empty"
}
}

How can I get these response errors in an app?

Kind regards,

Arie

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

connect to mysql database

Hi Koning,

You can add "Success" event handler to the datasource of your service and populate it with following code:

pre

//print all response to the console.
console.log(data);

//print "data.response.message" to console.
console.log(data.response.message);

/pre

Regards.

Koning Voetbal
Posts: 0
Joined: Thu Feb 27, 2014 2:21 pm

connect to mysql database

Tnx for answering but unfortually that doesn't work for me ....

I have put this javascript in Pages -- signup -- Data tab -- Component: login, Event: Error, Action: Run javascript, Details: your javascript

When I test this in the browser, the spinner is is going round and round with no ending .........

Any idea what goes wrong?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

connect to mysql database

Hello!

Are there any errors in console?

Return to “Issues”