Click here to Skip to main content
15,884,472 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: [Learning/Beginner] Confused about await, async and fetch. Pin
Maximilien2-May-23 10:27
Maximilien2-May-23 10:27 
AnswerRe: [Learning/Beginner] Confused about await, async and fetch. Pin
Richard Deeming2-May-23 22:33
mveRichard Deeming2-May-23 22:33 
GeneralRe: [Learning/Beginner] Confused about await, async and fetch. Pin
Maximilien3-May-23 2:41
Maximilien3-May-23 2:41 
GeneralRe: [Learning/Beginner] Confused about await, async and fetch. Pin
Jeremy Falcon3-May-23 10:13
professionalJeremy Falcon3-May-23 10:13 
GeneralRe: [Learning/Beginner] Confused about await, async and fetch. Pin
Maximilien3-May-23 12:56
Maximilien3-May-23 12:56 
GeneralRe: [Learning/Beginner] Confused about await, async and fetch. Pin
Jeremy Falcon4-May-23 4:47
professionalJeremy Falcon4-May-23 4:47 
QuestionAxios Pin
darlina1-May-23 22:47
darlina1-May-23 22:47 
Questionjson and json-server with weird be valid json file. Pin
Maximilien21-Apr-23 2:17
Maximilien21-Apr-23 2:17 
(not sure where to ask this).

Still learning...not for work.

I have a valid json (geojson) file like this : (reduced for visibility, original : Murales subventionnées - Site web des données ouvertes de la Ville de Montréal )
it's a list of features but the id is in a sub field of the feature.
{
  "features": [
    {
      "type": "Feature",
      "properties": {
        "id": 1,
        "annee": "2007"
      },
      "geometry": { "type": "Point", "coordinates": [-73.622218, 45.58041] }
    },
    {
      "type": "Feature",
      "properties": {
        "id": 2,
        "annee": "2007"
      },
      "geometry": { "type": "Point", "coordinates": [-73.558029, 45.506855] }
    }
  ]
}

I can fetch the whole list with the following and it works :
fetch ("http://localhost:4000/features );

I'm trying to use fetch to get a single "feature" from the file:
fetch ("http://localhost:4000/features/1");

But this does not work, it returns nothing.

I tried different format for the fetch URL.

If I move the id property to the root of each item, it works, but I don't want to do that.

Am I missing something ?

Is there anything I can do ?

Thanks.
CI/CD = Continuous Impediment/Continuous Despair

AnswerRe: json and json-server with weird be valid json file. Pin
Richard Deeming21-Apr-23 2:32
mveRichard Deeming21-Apr-23 2:32 
GeneralRe: json and json-server with weird be valid json file. Pin
Maximilien21-Apr-23 4:15
Maximilien21-Apr-23 4:15 
GeneralRe: json and json-server with weird be valid json file. Pin
Richard Deeming21-Apr-23 5:37
mveRichard Deeming21-Apr-23 5:37 
QuestionApplication is "dead" when I open it in a browser Pin
arnold_w16-Mar-23 23:23
arnold_w16-Mar-23 23:23 
AnswerRe: Application is "dead" when I open it in a browser Pin
jschell5-Apr-23 6:30
jschell5-Apr-23 6:30 
QuestionJavascript Form Validation - Help needed Pin
Kobraz11-Mar-23 12:43
Kobraz11-Mar-23 12:43 
QuestionJavaScript Pin
Member 159403612-Mar-23 17:42
Member 159403612-Mar-23 17:42 
RantRe: JavaScript Pin
Richard Deeming2-Mar-23 21:24
mveRichard Deeming2-Mar-23 21:24 
JokeRe: JavaScript Pin
Jeremy Falcon8-Mar-23 12:57
professionalJeremy Falcon8-Mar-23 12:57 
SuggestionJavaScript Pin
Member 159403612-Mar-23 17:40
Member 159403612-Mar-23 17:40 
RantRe: JavaScript Pin
Richard Deeming2-Mar-23 21:24
mveRichard Deeming2-Mar-23 21:24 
GeneralRe: JavaScript Pin
jschell10-Mar-23 11:07
jschell10-Mar-23 11:07 
QuestionDisable a textbox inside Repeater control when any of the DropDownList values also inside Repeater, is selected Pin
Ihechi Alozie2-Mar-23 12:17
Ihechi Alozie2-Mar-23 12:17 
AnswerRe: Disable a textbox inside Repeater control when any of the DropDownList values also inside Repeater, is selected Pin
Richard Deeming2-Mar-23 21:27
mveRichard Deeming2-Mar-23 21:27 
QuestionHow to replace the select of my html Pin
sanphil2-Mar-23 1:07
sanphil2-Mar-23 1:07 
QuestionHow to display a pop up without click and without login Pin
Member 1593182922-Feb-23 6:20
Member 1593182922-Feb-23 6:20 
AnswerRe: How to display a pop up without click and without login Pin
Jeremy Falcon27-Feb-23 7:29
professionalJeremy Falcon27-Feb-23 7:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.