Recover Json after Success and use in PHP

Asked

Viewed 60 times

0

I have the javascript code that returns me in a 'msg' variable the result of a query made in PHP.

  var page = "busca.php";
    $.ajax({
        type: 'POST',
        dataType: 'html',
        url: page,

        data: {idtabela: idtabela},
        success: function (msg) {
            //preciso transferir os dados no formato json par ao php
            msg = $.parseJSON(msg);              
        }
    });

This data is json format, I need to transfer to another php file. To be more precise, I am using the Datatables plugin. I already loop an sql query in the database. Now I need to give the option to the user in which table he wants to query, thus changing the query at each click. I thought about doing in the file where the table is, a variable that receives the json and plays in Datatables

  • With datatables you can initial upload via an ajax https://datatables.net/manual/ajax, this is what you need?

  • I think that’s the answer, but I haven’t been able to roll the dice on Datatable yet.

No answers

Browser other questions tagged

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