var request = new XMLHttpRequest();
request.addEventListener('readystatechange', function (data) {
if (this.readyState == 4 && this.status >= 200 && this.status < 400) {
//data.responseText || data.responseXML;
}
});
request.open('POST', '...');
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
request.send(...);
[ { id: 1,
name: "Pinky",
text: "Little story about Pinky" },
{ id: 2,
name: "Brain",
text: "They'll take over the world" } ]
res.render('index', { pages: data });
each page in pages
p
h1= page.name
a= page.text
hr
for (var i = 0; i < len; ++i)
{
if ( !data.Flight.hasOwnProperty(i) ) {
continue;
}
var
segm_data = data.Flight[i].Segment
, suppliers = get_supplier(segm_data)
, flight_start_time = segm_data[0].Departure.attributes.Time
, flight_end_time = segm_data[0].Arrival.attributes.Time
, departure = segm_data[0].Departure.attributes
, arrival = segm_data[0].Arrival.attributes
;
var
dep_all_time = arrival.Date.split('-').reverse().join('-')+' '+arrival.Time
, arr_all_time = departure.Date.split('-').reverse().join('-')+' '+departure.Time
, flight_time = moment(dep_all_time).diff(arr_all_time,'seconds')
;
if (
(time2minutes(flight_start_time) < parseInt(this.filter.data.time.departure.start))
|| (time2minutes(flight_start_time) > parseInt(this.filter.data.time.departure.end))
|| (time2minutes(flight_end_time) < parseInt(this.filter.data.time.departure_back.start))
|| (time2minutes(flight_end_time) > parseInt(this.filter.data.time.departure_back.end))
|| flight_time > parseInt(this.filter.data.time.flight)*60
|| !in_array_array(suppliers,this.filter.data.airlines)
) {
status = false;
break;
}
}
var flight_start_time = segm_data[0].Departure.attributes.Time;
var flight_end_time = segm_data[0].Arrival.attributes.Time;
var departure = segm_data[0].Departure.attributes;
var arrival = segm_data[0].Arrival.attributes;
var dep_all_time = arrival.Date.split('-').reverse().join('-')+' '+arrival.Time;
var arr_all_time = departure.Date.split('-').reverse().join('-')+' '+departure.Time;
var departure = segm_data[0].Departure.attributes;
var arrival = segm_data[0].Arrival.attributes;
var flight_start_time = departure.Time;
var flight_end_time = arrival.Time;
var dep_all_time = arrival.Date.split('-').reverse().join('-')+' '+flight_end_time;
var arr_all_time = departure.Date.split('-').reverse().join('-')+' '+flight_start_time;