Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Post Timeline

removed some invisible characters that caused browsers issues when copy-pasting them
Source Link
Sygmoral
  • 7.2k
  • 2
  • 27
  • 33
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});​;
$.each(data, function(i, item) {
 alert(item.PageName);
});​;

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});​;

EDIT:

try with this and describes what the result

$.get('/Cms/GetPages/123', function(data) {
 alert(data);
});

FOR EDIT 3:

this corrects the problem, but not the idea to use "eval", you should see how are the response in '/Cms/GetPages/123'.

$.get('/Cms/GetPages/123', function(data) {
 $.each(eval(data.replace(/[\r\n]/, "")), function(i, item) {
 alert(item.PageName);
 });​;
});
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});​
$.each(data, function(i, item) {
 alert(item.PageName);
});​

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});​

EDIT:

try with this and describes what the result

$.get('/Cms/GetPages/123', function(data) {
 alert(data);
});

FOR EDIT 3:

this corrects the problem, but not the idea to use "eval", you should see how are the response in '/Cms/GetPages/123'.

$.get('/Cms/GetPages/123', function(data) {
 $.each(eval(data.replace(/[\r\n]/, "")), function(i, item) {
 alert(item.PageName);
 });​
});
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});
$.each(data, function(i, item) {
 alert(item.PageName);
});

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});

EDIT:

try with this and describes what the result

$.get('/Cms/GetPages/123', function(data) {
 alert(data);
});

FOR EDIT 3:

this corrects the problem, but not the idea to use "eval", you should see how are the response in '/Cms/GetPages/123'.

$.get('/Cms/GetPages/123', function(data) {
 $.each(eval(data.replace(/[\r\n]/, "")), function(i, item) {
 alert(item.PageName);
 });
});
added 327 characters in body
Source Link
andres descalzo
  • 15k
  • 14
  • 66
  • 119
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});​
$.each(data, function(i, item) {
 alert(item.PageName);
});​

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});​

EDIT:

try with this and describes what the result

$.get('/Cms/GetPages/123', function(data) {
 alert(data);
});

FOR EDIT 3:

this corrects the problem, but not the idea to use "eval", you should see how are the response in '/Cms/GetPages/123'.

$.get('/Cms/GetPages/123', function(data) {
 $.each(eval(data.replace(/[\r\n]/, "")), function(i, item) {
 alert(item.PageName);
 });​
});
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});​
$.each(data, function(i, item) {
 alert(item.PageName);
});​

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});​

EDIT:

try with this and describes what the result

$.get('/Cms/GetPages/123', function(data) {
 alert(data);
});
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});​
$.each(data, function(i, item) {
 alert(item.PageName);
});​

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});​

EDIT:

try with this and describes what the result

$.get('/Cms/GetPages/123', function(data) {
 alert(data);
});

FOR EDIT 3:

this corrects the problem, but not the idea to use "eval", you should see how are the response in '/Cms/GetPages/123'.

$.get('/Cms/GetPages/123', function(data) {
 $.each(eval(data.replace(/[\r\n]/, "")), function(i, item) {
 alert(item.PageName);
 });​
});
added 136 characters in body
Source Link
andres descalzo
  • 15k
  • 14
  • 66
  • 119
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});​
$.each(data, function(i, item) {
 alert(item.PageName);
});​

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});​

EDIT:

try with this and describes what the result

$.get('/Cms/GetPages/123', function(data) {
 alert(data);
});
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});​
$.each(data, function(i, item) {
 alert(item.PageName);
});​

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});​
var data = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
 
$.each(data, function(i, item) {
 alert(data[i].PageName);
});​
$.each(data, function(i, item) {
 alert(item.PageName);
});​

these two options work well, unless you have something like:

var data.result = [ 
 {"Id": 10004, "PageName": "club"}, 
 {"Id": 10040, "PageName": "qaz"}, 
 {"Id": 10059, "PageName": "jjjjjjj"}
];
$.each(data.result, function(i, item) {
 alert(data.result[i].PageName);
});​

EDIT:

try with this and describes what the result

$.get('/Cms/GetPages/123', function(data) {
 alert(data);
});
Source Link
andres descalzo
  • 15k
  • 14
  • 66
  • 119
Loading
lang-js

AltStyle によって変換されたページ (->オリジナル) /