jQuery load Google Visualization API with AJAX

后端 未结 10 2243
栀梦
栀梦 2020-12-24 02:17

There is an issue that I cannot solve, I\'ve been looking a lot in the internet but found nothing.

I have this JavaScript that is used to do an Ajax request by PHP.

10条回答
  •  不思量自难忘°
    2020-12-24 02:52

    i am not familiar at all with the google apis, but i guess that 'html' in the callback is actually json or script, you can try the $.ajax 'dataType' option:

    $.ajax({
        type: "POST",
        url: "getTIER1Tickets.php",
        dataType: "json",//"script"
        data: "",
        success: function(html){
            // Succesful, load visualization API and send data      
            google.load('visualization', '1', {'packages': ['annotatedtimeline']}); 
            google.setOnLoadCallback(drawData(html));                                                   
        }
    });
    

    more info: http://api.jquery.com/jQuery.ajax/

提交回复
热议问题