Skip to main content
arrow_man
Participating Frequently
April 5, 2018
Answered

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

  • April 5, 2018
  • 2 replies
  • 2180 views

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

    This topic has been closed for replies.
    Correct answer kglad

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

        }

        }

    });

    }

    2 replies

    arrow_man
    arrow_manAuthor
    Participating Frequently
    April 5, 2018

    In the example, what is the missing code

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    April 5, 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, 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';

        }

        }

    });

    }

    arrow_man
    arrow_manAuthor
    Participating Frequently
    April 5, 2018

    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.

    kglad
    Community Expert
    Community Expert
    April 5, 2018

    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.