I try to call a function within a JQuery ajax call, but it keeps showing me "TypeError: c.slice is not a function", I don't quite understand why this happens? I appreciate your help! Thank you in advance!
Here is my AJAX call:
$.ajax({
url: "my.php",
method: "get",
dataType: "json",
data: requestJSON,
success: function(jsondata){
$.getJSON('my.php?callback=?', function (data) {
// Create the chart
$('#historicalcharts').highcharts('StockChart', {
rangeSelector : {
selected : 1
},
title : {
text : 'AAPL Stock Price'
},
series : [{
name : 'AAPL Stock Price',
data : data,
type : 'area',
threshold : null,
tooltip : {
valueDecimals : 2
},
fillColor : {
linearGradient : {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops : [
[0, Highcharts.getOptions().colors[0]],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
}
}]
});
});
});
}
I try to mimic the function in this link, the only difference is that it retrieves the JSON data on each call, but I use a JSON data that I get from my php script. http://www.highcharts.com/stock/demo/area
Here is my php code
<?php
if (isset($_GET['request'])) {
header("content-type: application/json");
$retrievechartJSON = 'http://dev.markitondemand.com/MODApis/Api/v2/InteractiveChart/json?parameters=' . $_GET['request'];
$json = file_get_contents($retrievechartJSON);
echo $_GET['callback']. '('. $json . ')';
?>