• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Contacting mysql from inside Animate via php (v5.6.32)

New Here ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

I think this could be achievable ... any suggestions? Thank you!

animate.jpgphp.jpg

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 05, 2018 Apr 05, 2018

i use:

function sendDataF(methodS,dataTypeS,urlS,dataObj,f){

$.ajax({

    // the URL for the request

    url : urlS;

    // the data to send

    data : dataObj,

    // whether this is a POST or GET request

    type : methodS,

    // the type of data returned

    dataType : dataTypeS,

    // code to run if the request succeeds;

    // the response is passed to the function

    success : f,

    // code to run if the request fails;

    error: function(ts) { alert(ts.responseStatus); },

    error : function(xhr, st

...

Votes

Translate

Translate
Community Expert ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

yes, you can use ajax with animate and you can use jquery with animate.

one way to add jquery is to add an html5 component.  another is to use the global include in the actions panel.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

In the example, what is the missing code

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

i use:

function sendDataF(methodS,dataTypeS,urlS,dataObj,f){

$.ajax({

    // the URL for the request

    url : urlS;

    // the data to send

    data : dataObj,

    // whether this is a POST or GET request

    type : methodS,

    // the type of data returned

    dataType : dataTypeS,

    // code to run if the request succeeds;

    // the response is passed to the function

    success : f,

    // code to run if the request fails;

    error: function(ts) { alert(ts.responseStatus); },

    error : function(xhr, status) {

    var errorS = '';

    for(s in xhr){

    errorS += s+' : '+xhr+'\n';

    }

        alert('Sorry, there was a problem!\n'+errorS+'\nstatus:'+status);

    },

    // code to run regardless of success or failure

    complete : function(xhr, status) {

        var errorS = '';

    for(s in xhr){

    errorS += s+' : '+xhr+'\n';

    }

    }

});

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

I'm not sure, kglad. Your answer looks very generic and I do not know how to implement it in the example without making mistakes in my effort to try to prove it.

The example is quite descriptive and should be simple to answer. The idea is to send the contents of the variables "x_user" and "x_pass" to "check_member.php".

Then, back in Animate, present the answer, that is, whether the member exists or not in the registry.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

use the code i suggested and:

var dataObj={x_user:x_user,x_pass:x_pass}

sendDataF('POST','html','path to your php file/filename.php',dataObj,parseResponseF)

function parseResponseF(htmlS){

alert(htmlS);

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2018 Apr 06, 2018

Copy link to clipboard

Copied

Things are getting more and more strange.

How is it possible that so many lines of code are needed to replace two lines of old code? If that is the case then things have gone wrong. And I mean, very, very wrong.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2018 Apr 06, 2018

Copy link to clipboard

Copied

feel free to look for other answers or further elucidate your conservation of code lines theory.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2019 Oct 13, 2019

Copy link to clipboard

Copied

Hi, I'm having trouble running this. Until today I have not been able to make it work. I have already made more than a thousand attempts and I don't know where the error is. I am using PHP 7.2 and I have recreated an even simpler scenario without finding a solution. To get an idea, the problem is about the following: In the canvas scene (Animate CC) I have a symbol as large as the canvas itself containing a button and two areas of dynamic text. In the first text area the user writes his name then clicks on the button and then, in the second text area, receives the email from the person. Naturally I have a database with corresponding names and emails. If I write more details, do you think you can tell me how to do it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 24, 2021 Sep 24, 2021

Copy link to clipboard

Copied

LATEST

Friend, your answer is awesome, but could you send an example animate file with the script and php file with database connection?

That would help me a lot.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines