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

connect to mysql database

Yep, in the console in FF looks everything allright.

On the answer tab there is: {"error":true,"message":"Sorry, this email already existed"}

So it got the right response but how get I this is an javascript alert as a popup or inline in the app?

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

connect to mysql database

Hi Koning,

You have this:

pre

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

/pre

But we've suggested your "success" event handler instead of "error".

Please try it.

If you still will have this problem after trying "success" please give us your app public link and describe steps to reproduce this problem.

Regards.

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

connect to mysql database

Hi,

You are right, you suggested Success but I have tried that one and try to use Error instead but both events doesn't work.

With the event Success the spinner is going round and round with no ending.

In the Console in Firefox I get :

Object { error=true, message="Sorry, this email already existed"}
That's look OK as a response because I use an excisting e-mail address

TypeError: data.response is undefined
console.log(data.response.message);
Probebly this is the problem?

With the app public link you mean the url which I have in the browser when testing the app?

This is http://appery.io/app/mobile-frame?src...

Kind regards,

Arie

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

connect to mysql database

Hi Koning,

Ok, in this case you have some other response, and you need to use following code:

pre

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

//print "data.error" to console.
console.log("is error = " + data.error);

//print "data.message" to console.
console.log("is error = " + data.message);

//Here you use data object in accordance to your needs.

/pre

Regards.

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

connect to mysql database

OK, this is working fine now.

I have an alert to show the response:

alert(data.message);

But how can I get this response in a label field which has default no text but will be filled with the response messages. I tried

$('label[name=label_response_aanmaken_account]').val(data.message);

But the label doesn't show the response text.

Or does I need to use a text aerea in stead of a label to get this done?

Any idea what I'm doing wrong?

Kind regards,

Arie

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

connect to mysql database

Hi Koning,

Here is correct code for your goal:

pre

//Note: you should replace "label_response_aanmaken_account" with your label component name.
Appery("label_response_aanmaken_account").text(data.message);

/pre

Regards.

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

connect to mysql database

Tnx, it's working now!

abigdreamer
Posts: 0
Joined: Fri Jul 12, 2013 7:20 pm

connect to mysql database

This was a free solution and it worked well for you? Can you share any Pages, plugins, or services code with others?

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

connect to mysql database

Yep it works fine for me.

The API with documentation / examples is found here : http://www.androidhive.info/2014/01/h...

Success with your implementation!

Return to “Issues”