json - not well-formed Source File in mozilla firefox -



json - not well-formed Source File in mozilla firefox -

following content of json file -

{ "tags": [ "red", "green", "blue", "yellow" ] }

i checked jsonlint still getting next error in firefox.

timestamp: quarta-feira 18 june 2014 10:39:41 ist error: not well-formed source file: file:///home/trialcode/trialcode/projects/ang/18-06-2014/ang/content.json line: 1, column: 1 source code: {

i not sure doing wrong if any.

fyi -

os - linux ubuntu 12.04

firefox - 24.0

edit

i using content of content.json file in angular controller via $http.get method.

i explored more kind of error , found related content-type setting.

following total code -

<!doctype html> <html lang="en" ng-app="app"> <head> <title>json read in angularjs</title> <meta charset="utf-8" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script> <script> var app = angular.module('app', []); app.controller('myctrl', function($scope, $http){ $scope.data = {}; $http.get('content.json').success(function(data) { $scope.data = data; }); }); </script> </head> <body ng-controller="myctrl"> <ul> <li ng-repeat="em in data.tags">{{em}}</li> </ul> </body> </html>

how set content type if problem. searched here unable prepare it. help me please if any.

after few hours of searching came across -

chrome , other modern browsers have implemented security restrictions cross origin requests, means cannot load through file:/// , need utilize http:// protocol @ times, locally -due same origin policies.

source -

cross origin script stackoverflow answer simple solution local cross origin requests

json angularjs firefox content-type http-get

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -