In return call function to execute a query in Mysql

Asked

Viewed 420 times

1

I need to make an appointment in my comic when returning from a insert, but I’m not able to implement it. I have this in return:

        $.post(
        'GravaFase.php',
        params,
        function( json, textStatus, jQxhr )
        {               
            if (json.status != "ERRO") {
                var msg = '<div class="alert alert-info" role="alert">' + json.msg + '</div>' ;
            } else {
                var msg = '<div class="alert alert-danger" role="alert">' + json.msg + '</div>' ;
            }
            $("#resultado-fase").html(msg); 

            // APÓS CARREGAMENTO COMPLETO DA PÁGINA
            $(document).ready(function() {
                $("#resultado-tabela").load("DetalhesContrato.php", {IdContrato: 34});
            });     

        },
        'json'
    )

I would not like to reload the page again, just pass the parameter and run a select, I am using the load. Is there anything that can be done?

  • I don’t understand your question. Are you having problems with PHP or Javascript/jQuery? This code you have placed is incomplete, what is params for example?

  • Hello @Sergio, need when returning from recording a record make a select to update a table I have and do not see the need to keep mounting the table with the entered results, the idea then would be ai return from Insert make this select by means of a function call, but could not.

  • it is not necessary to use $(document).ready(function() { within the callback, because when this function is called the page is already ready (fully loaded)

  • Hello @Sanction, thanks for having responded, tell me one thing, in this example that I did above the page is being fully loaded in the div "result-table", how can I load the same without being in the div?

  • Yes, I’ve looked at the function. load() but my problem is the message I give to the user in return, I did something like this: window.setTimeout('Location.Reload()', 5000);

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.