I got from AJAX query a string like this: - var ansverStr = "[1,\"Bedford Street\",\"Oxford Circus, Green Park or Westminster\",\"15\",\"Regent Street\",1343329406000]\r\n
-
[1,\"Bedford Street\",\"Oxford Circus, Green Park or Westminster\",\"13\",\"Golders Green\",1343329883000]\r\n
-
[1,\"Bedford Street\",\"Oxford Circus, Green Park or Westminster\",\"176\",\"Tottenham Ct Rd\",1343329612000]"
... etc
Created a dynamic table to expose the data: - var element;
-
element = '' + ansverStr.split('\r\n').map(function(line){ return '' + JSON.parse(line).map(function(cell){ return '' + cell + ''; }).join('') + ''; }).join('') + ''; document.getElementById("bStop").innerHTML=element;
The last field in ansverStr substrings is a time.
The question: How can I access to those values in this column in dynamic table to convert them into time format
2 1798 Frinavale 9,735
Recognized Expert Moderator Expert
Like this: - var ansverStr = "[1,\"Bedford Street\",\"Oxford Circus, Green Park or Westminster\",\"15\",\"Regent Street\",1343329406000]\r\n [1,\"Bedford Street\",\"Oxford Circus, Green Park or Westminster\",\"13\",\"Golders Green\",1343329883000]\r\n [1,\"Bedford Street\",\"Oxford Circus, Green Park or Westminster\",\"176\",\"Tottenham Ct Rd\",1343329612000]";
-
-
var lines = ansverStr.split('\r\n');
-
-
var elementContent= "";
-
-
for(lineIndex = 0; lineIndex<lines.length; lineIndex++) {
-
var row = JSON.parse(lines[lineIndex]);
-
-
for (i = 0; i < row.length; i++) {
-
var rowData = row[i];
-
if (i == row.length - 1) {
-
var d = new Date(rowData);
-
elementContent = elementContent + " " + d;
-
} else {
-
elementContent = elementContent + " " + rowData;
-
}
-
}
-
-
elementContent = elementContent + "<br /> "
-
-
}
-
-
document.getElementById("bStop").innerHTML = elementContent;
-Frinny
Thanks, the most elegant solution :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: daisy |
last post by:
Can anyone point me to the syntax on how to fetch
indiviual column values from the current row in a
datagrid on a button click in C# or VB.
|
by: ssb |
last post by:
Hello,
This may be very elementary, but, need help because I am new to access
programming.
(1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor
?) the values one by one and...
|
by: hazz |
last post by:
The datareader below contains two rows of two columns but in the for loop,
the values for only the first row are getting printed twice. How do I get to
the values of the second row? Thanks. -hazz...
|
by: jeoffh |
last post by:
Background:
I am trying to "merge" some attributes into an existing XML column in my MS SQL 2005 database. The general idea is that I have an XML column in a table and I would like to update/delete...
|
by: san1014 |
last post by:
Hi
I have a table
SQL> select * from nodes;
NODE_ID NODE_NAME
-------------------- ------------------------------
N1 Kothhapet
N2 Nagole...
| |
by: gkinu |
last post by:
Application-Generated Column Values in DataGridView on New Record
I have a DataGridView which I am using to enter new records to a table with 5 columns/fields. However, values for two of the...
|
by: Shikha1234 |
last post by:
Hi,
I have a database which has a primary key field (integer).
It should be autogenerated on every insert statement.
I am hardcoding it everytime to remove the error that the data supplied is...
|
by: CreativeMind |
last post by:
hi all , actually i am binding a datagrid with a dataview which has a
datatable showing output like
this..
propertyid viewname
1 fronside
1 lefttside
1 ...
|
by: Nelson Joseph |
last post by:
Hi All,
I have a file which contains set of data in the following format.
Title1
Title1, Title2,
Title3
A B C D
1 1 1 1
2 3 4 6
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |