Tagged Questions
0
votes
5answers
48 views
Create object from a string, javascript
Is it possible to create an object from a string content?
For example, I have a string "{ name: John }" how can I simply parse it to create an object { name: 'John' } ?
UPDATE
Unfortunately ...
3
votes
2answers
40 views
Why is “\n” a number “NaN” in Javascript
In JavaScript on Chrome and Firefox:
isNaN( "\n" ) gives false
parseFloat ( "\n" ) gives NaN
The same is yielded for \t, \r and \f.'
\n is a number
Parsed \n gives you Not A Number.
Escaped ...
1
vote
1answer
31 views
Javascript Date with Timezone from EventBrite
Basically my goal is to parse a string into a Date properly, I have most of the work done as in I get the Date and time into a JavaScript Date object, but I'm unsure of how to parse and apply the ...
0
votes
7answers
56 views
How to call a Javascript passing a variable from PHP
I am trying to call a javascript function from php code, which it will receive a php variable from an input form. Once Javascript function received this variable or value it will call a php ...
0
votes
1answer
54 views
How to pass javascript variable to php in html? (wikipedia parsing)
Hi I'm trying to pass a javascript variable called $url to a function in php all located in the same html file. The logic here is that there is a text box and the user inputs a species and we call the ...
5
votes
10answers
179 views
How to check if a string is a natural number?
In javascript, how can you check if a string is a natural number (including zeros)?
Thanks
Examples:
'0' // ok
'1' // ok
'-1' // not ok
'-1.1' // not ok
'1.1' // not ok
'abc' // not ok
0
votes
1answer
37 views
Parse XML with JavaScript?
So, I would like to know how to parse an xml document with JavaScript.
I've got it working in php (view below)
<?php
$xmlGmailFeed = ...
0
votes
2answers
42 views
Accessing the content of a parsed JSON text [closed]
I am reading an http request containing JSON and parsing it like this:
res = JSON.parse(httpRequest.responseText)
The result of my request is:
{"node":[{"id":"10","name":"a_name"}], ...
0
votes
0answers
12 views
Parsing YAML with yamljs throws parse-error
I am trying to parse YAML encoded data with yamljs in NodeJS.
Here the part of my code:
var YAML = require('yamljs');
var js_object = YAML.parse(yaml_string);
This throws:
{
...
-9
votes
0answers
26 views
parsing the result of a javascript routine [closed]
So I am trying to parse the information contained within a specific URL from my android program. I can open the URL connection and read the source no problem. But, I am only grabbing the JavaScript ...
0
votes
1answer
34 views
Reading logfile with javascript. How to format the log? [closed]
Im making an program with Python that parses a file and logs the changes to the file. Now my issue is that what format would be the best way to store this information so it would be usable with ...
0
votes
1answer
49 views
Parsing a file as an input with html and JavaScript
I've created a website with html and JavaScript, that illustates the K-means algorithm.
Moreover, I have made a simulator that works with an autogenerated random dataset.
Now, I want to give the ...
-3
votes
1answer
50 views
Read txt file's lines in JS (Node.js) [duplicate]
I want to read a text file (.txt) using Node.js. I need to push each of text's lines into array, like this:
a
b
c
to
var array = ['a', 'b', 'c'];
How can I do this?
2
votes
2answers
76 views
Error in JSON file
When I am using below code :
{
"info":[
{
"name": "Adam",
"address": "Park Street"
}
]
}
It is parsing perfectly
but adding on further code like:
{
...
0
votes
0answers
35 views
JSON Building in Node.js with YQL parsing
Respected ppl ....
This is my node.js code ...
https://gist.github.com/SkyKOG/99d47dbe5a2cec97426b
Im trying to parse the data of our exam results ...example ...
...