Jump to content

robb28

New Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

robb28's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks for helping it works now i got 1 more question: i have to use ajax i think the (post methode) what i try to do is the lane 1 2 3 4 is now on 1 1 5 2 but what i want is that if i press on one button that it will be stored on the button I last clicked on. do you know how to use this and where i have to put it in de code? //jsonfile = '[{"lane 1":"1","lane 2":"1","lane 3":"5","lane 4":"2"}]'; var jsonRequest = new XMLHttpRequest(); jsonRequest.onreadystatechange = function () { if (jsonRequest.readyState == 4 && jsonRequest.status == 200) { var initialstate = JSON.parse(jsonRequest.responseText); setLaneStates(initialstate); console.log('Done loading JSON data'); } else { console.log('Failed to get JSON data'); } } jsonRequest.open( "GET", "data.json", true); jsonRequest.send( null );
  2. i have to save it in my folder( where i have my code)
  3. Hi Everyone, i need some help how can i save this jsonfile to the webserver? my code // Load initial values from JSON 'file' jsonfile = '[{"lane 1":"1","lane 2":"1","lane 3":"5","lane 4":"2"}]'; var initialstate = JSON.parse(jsonfile); setLaneState("lane1",initialstate[0]['lane 1']) setLaneState("lane2",initialstate[0]['lane 2']) setLaneState("lane3",initialstate[0]['lane 3']) setLaneState("lane4",initialstate[0]['lane 4'])
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.