Getting an error in browser console, override func didMoveToView(view: SKView) {
let ballUp = getRandomBallUp()
let ballTexture1 = SKTexture(imageNamed: ballUp)
ballTexture1.filteringMode = SKTextureFilteringMode.Nearest
let ballTexture2 = SKTexture(imageNamed: getCorrespondingRandomBallDown(ballUp)
ballTexture2.filteringMode = SKTextureFilteringMode.Nearest
let anim = SKAction.animateWithTextures([ballTexture1, ballTexture2], timePerFrame: 0.15)
let upDown = SKAction.repeatActionForever(anim)
ball = SKSpriteNode(texture: ballTexture1)
ball.position = CGPoint(x: self.frame.size.width / 2.8, y:CGRectGetMidY(self.frame))
ball.runAction(upDown)
self.addChild(ball)
}
. I'm simply trying/testing to log the json data.
SyntaxError: Unexpected token '&'. Expected a property name.
$daily_clicks data being passed:
$var = {{ json_encode($daily_clicks) }};
console.log($var);
Any idea why I'm getting that error?
In web console, data is being displayed as:
{
"Feb 6, 2016": 0,
"Feb 7, 2016": 0,
"Feb 8, 2016": 7,
"Feb 9, 2016": 5,
"Feb 10, 2016": 0,
"Feb 11, 2016": 0,
"Feb 12, 2016": 0
}
答案 0 :(得分:4)
In a number of template languages, surrounding the identifier of a piece of data with WebApiConfig.Register
and {{
converts it to HTML.
The HTML special characters are invalid in that context in JavaScript.
You need to force whatever template language you are using (you didn't specify in the question) to output raw data.
Some templates which use that syntax use }}
and {{{
for raw output.