Pass generated javaScript code to another page inside the script tag

0

I have two functions one prepares the data and makes a call to Ajax and within the call to Ajax has a callback to another function. As per the code below:

function retorno_pizza_nacionalidade(result){
console.log(result);
}

function grafico_pizza_nacionalidade(){
var dados = "typepost=grafico_pizza_nacionalidade";

AjaxExecute("php/main_index.php", dados, retorno_pizza_nacionalidade, erro);
}

This all works perfectly, the problem is that I need to pass the return of the function return_pizza_nationality into the tag that is on my index.php page how can I do this with javascript or JQuery. I researched a lot, but I did not find anything like that. Below the return I need to "paste" inside the tag. Thanks in advance.

$(function () {
            Highcharts.chart('pie', {
                chart: {
                    plotBackgroundColor: null,
                    plotBorderWidth: null,
                    plotShadow: false,
                    type: 'pie'
                },
                title: {
                    text: 'Frequência Nacionalidade'
                },
                tooltip: {
                    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                },
                plotOptions: {
                    pie: {
                        allowPointSelect: true,
                        cursor: 'pointer',
                        dataLabels: {
                            enabled: true,
                            format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                            style: {
                                color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                            }
                        }
                    }
                },
                series: [{
                    name: 'Brands',
                    colorByPoint: true,
                    data: [{name:'Afeganistão', y:50.00},{name:'Brasil', 
       y:50.00}]
                }]
            });
        });
    
asked by anonymous 01.06.2017 / 23:18

0 answers