0

The parse method is not working.

$.get("viewsGroup.process", function(data) {
    $("#view_group").modal("show");
    alert(data);                  // this shows the no of objects..
    var data = $.ParseJSON(data); // not working ....
    alert("datata" + data);       // not working..
    console.log(data.name);
    alert("bacjkkkk");
});
thefourtheye
  • 233,700
  • 52
  • 457
  • 497
  • The last argument for $.get is the dataType, just set that and jQuery does this for you – adeneo Apr 06 '14 at 06:15
  • you could also just use `$.getJSON("url", function(d){ //stuff here })`. – royhowie Apr 06 '14 at 06:19
  • 1
    It's difficult to help you if you just say "not working". This doesn't really give us any idea about what the problem could be. [Learn how to](http://www.creativebloq.com/javascript/javascript-debugging-beginners-3122820) [**debug** JavaScript](https://developers.google.com/chrome-developer-tools/docs/javascript-debugging), and maybe you can help yourself. – Felix Kling Apr 06 '14 at 06:38
  • Felix Kling sir...problem is that...$.get("viewsGroup.process", function(data) //data is json String of type(jsonArrray) this (data) String have a list as a object....i want to convert it Using $.parseJSON(data)//this is not working not converting it...after converstion i want to use (each) loop to show the all objects that data one by one using loop (each).//it is not converting from json thats why the rest of work i cannot do... – user3497147 Apr 06 '14 at 06:56
  • Again, what does "not working" mean? Do you get an error? Don't you get the output you expect? What is the result of `$.parseJSON(data)`? – Felix Kling Apr 06 '14 at 07:03
  • donot get the result...no eroor .. – user3497147 Apr 06 '14 at 07:19

2 Answers2

0

You have a typo:

$.ParseJSON(data); should be $.parseJSON(data);

Hoping this will help.

Amit Joki
  • 58,320
  • 7
  • 77
  • 95
  • i know that is $.parseJSON(data);//but problem is that..data is list type jsonArray String..and my code is not working after that point where i am pasrsing the json string (data). – user3497147 Apr 06 '14 at 06:29
0

I would simplify the code as such:

$.getJSON("viewsGroup.process", function (d) {
    $("#view_group").modal("show");
    console.log(d);

    //whatever else you want to do

})
royhowie
  • 11,075
  • 14
  • 50
  • 67