Highlighted

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

New Here ,
Apr 05, 2018

Copy link to clipboard

Copied

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

animate.jpgphp.jpg

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

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';

    }

    }

});

}

Views

466

Likes

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

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

New Here ,
Apr 05, 2018

Copy link to clipboard

Copied

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

animate.jpgphp.jpg

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

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';

    }

    }

});

}

Views

467

Likes

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
Apr 05, 2018 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Apr 05, 2018 0
New Here ,
Apr 05, 2018

Copy link to clipboard

Copied

In the example, what is the missing code

Likes

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
Reply
Loading...
Apr 05, 2018 0
Adobe Community Professional ,
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';

    }

    }

});

}

Likes

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
Reply
Loading...
Apr 05, 2018 2
New Here ,
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.

Likes

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
Reply
Loading...
Apr 05, 2018 0
Adobe Community Professional ,
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);

}

Likes

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
Reply
Loading...
Apr 05, 2018 1
New Here ,
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.

Likes

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
Reply
Loading...
Apr 06, 2018 0
Adobe Community Professional ,
Apr 06, 2018

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Apr 06, 2018 0
victor95 LATEST
New Here ,
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?

Likes

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
Reply
Loading...
Oct 13, 2019 0