Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  80] [ 4]  / answers: 1 / hits: 16010  / 11 Years ago, thu, january 23, 2014, 12:00:00

It gaves me error when I m trying to call this controller .



hiren.controller('hirenz' , function($scope , $http , $location , $routeParams){
$http.post((rootURL + music) , {'alpha' : $routeParams.alpha , 'name' : $routeParams.name ,
'album' : $routeParams.albumname }).success(function(data){
var parsedJson = JSON.parse(data) ;
console.log(parsedJson.name);
});
});


Here is the data that i am calling from server



{
name: [
Adhar - Adhar ,
Adhar - Adhare Opshori ,
Adhar - Aj Neshay
],
url: [
http://music-com-bd.com/Music/A/Adhar/Adhare Opshori/Adhar - Adhar (music.com.bd).mp3,
http://music-com-bd.com/Music/A/Adhar/Adhare Opshori/Adhar - Adhar (music.com.bd).mp3,
http://music-com-bd.com/Music/A/Adhar/Adhare Opshori/Adhar - Adhar (music.com.bd).mp3
]
}

More From » json

 Answers
1

You are parsing something which is not a string. It might be already in form of JSON object.
You do not need to parse it.
If you change var parsedJson = JSON.parse(data) ; to var parsedJson = data; The error will go off.


[#72988] Wednesday, January 22, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dayshadelaniej

Total Points: 668
Total Questions: 121
Total Answers: 121

Location: Sao Tome and Principe
Member since Wed, Dec 21, 2022
1 Year ago
;