Page 4 of 4

connect to mysql database

Posted: Mon Sep 08, 2014 7:17 am
by Koning Voetbal

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?


connect to mysql database

Posted: Mon Sep 08, 2014 9:48 pm
by Yurii Orishchuk

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.


connect to mysql database

Posted: Tue Sep 09, 2014 9:16 am
by Koning Voetbal

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


connect to mysql database

Posted: Wed Sep 10, 2014 1:30 am
by Yurii Orishchuk

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.


connect to mysql database

Posted: Wed Sep 10, 2014 7:48 am
by Koning Voetbal

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


connect to mysql database

Posted: Wed Sep 10, 2014 10:41 pm
by Yurii Orishchuk

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.


connect to mysql database

Posted: Thu Sep 11, 2014 7:27 am
by Koning Voetbal

Tnx, it's working now!


connect to mysql database

Posted: Sun Sep 21, 2014 5:50 am
by abigdreamer

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


connect to mysql database

Posted: Mon Sep 22, 2014 12:22 pm
by Koning Voetbal

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!