Answer the question
In order to leave comments, you need to log in
How to parse Json from another site using Jquery or JS?
It is necessary to process json located at the link testlodtask20172.azurewebsites.net/task/qyfgqiyhwfoq1
and json at this link testlodtask20172.azurewebsites.net/task in Jquery or Js.
The problem is that I don't know how to refer to the format
and format code{"name":"Stan Smith","sex":"male","age":30}
[{"id":"qyfgqiyhwfoq1","name":"Stan Smith","sex":"male"},{"id":"qmvqqwrqsds2","name":"Jack Anderson","sex":"male"} ... ]
$.ajax({
url: 'http://testlodtask20172.azurewebsites.net/task/qyfgqiyhwfoq1',
type: 'GET',
dataType: 'jsonp',
crossDomain: true,
});
Answer the question
In order to leave comments, you need to log in
var response = // Ваш AJAX запрос
var jsonObj = JSON.parse(response);
// Печатаем в консоль id из вторых фигурных скобок
console.log(jsonObj[1].id);
JSON - JavaScript Object Notation
This is a regular JS object represented as a string.
JSON.parse() to the rescue
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question