0
我有PHP json字符串。在JSON中解析字符串js函數作爲js函數
{"formatter":"function(){ return '<b>' + this.series.xAxis.categories[this.point.x] + '<\/b> sold <br><b>' + this.point.value + '<\/b> items on <br><b>' + this.series.yAxis.categories[this.point.y] + '<\/b>'; }"}
我可以將JSON到PHP STRING這樣這個答案的幫助Stackoverflow Answer
{"formatter":function(){ return '<b>' + this.series.xAxis.categories[this.point.x] + '<\/b> sold <br><b>' + this.point.value + '<\/b> items on <br><b>' + this.series.yAxis.categories[this.point.y] + '<\/b>'; }}
但是,當我嘗試JSON解析成對象與
jQuery.parseJSON(variableContainingPHPJSONstring)
我有錯誤,如這個。
未捕獲的SyntaxError:意外的標記ü在JSON第14位的
這是我對這個工作是一個HIGHCHART的JSON。
我只有與功能部件問題在這裏。 在工具提示:formatter
JSON中不允許使用函數,所以顯然解析失敗。 – trincot
第二個不再是JSON,而是一個JavaScript對象。你不能使用'jQuery.parse'解析。 –
我知道它...但我想要一種方法來實現這個... @trincot –