I have a problem in posting data using json

Hi, I need some help to know what’s wrong with this code

 <JavaScript>
       var Observable=require"FuseJS/Observable"

       var status=0;
       var response_ok=false;

       var username.value=Observable("");
       var password.value=Obserable("");

      function loginPostData() {
        var myVar={
          "users":{
            "username":"username",
            "password":"password"
          }
        };
        fetch('http://osamaarafa96.esy.es/login.php', {
   method: 'POST',
   headers: { "Content-type": "application/json"},
   body: JSON.stringify(myVar)
}).then(function(response) {
   status = response.status;  // Get the HTTP status code
   response_ok = response.ok; // Is response.status in the 200-range?
   console.log("Response: " + JSON.stringify(response));
   return response.json();    // This returns a promise
}).then(function(responseObject) {
   // Do something with the result
   console.log('the API said: ' + JSON.stringify(responseObject));
}).catch(function(err) {
   // An error occured parsing Json
   console.log('Error : the API said: ' + JSON.stringify(responseObject));
});
      }

      module.exports = {
             loginPostData:loginPostData
        }
}

You just have some small typos. This seems to work:

<App>
    <JavaScript>
       var Observable = require("FuseJS/Observable");

       var status=0;
       var response_ok=false;

       var username=Observable("");
       var password=Observable("");

      function loginPostData() {
        var myVar={
          "users":{
            "username": username.value,
            "password": password.value
          }
        };
        fetch('http://osamaarafa96.esy.es/login.php&#39;, {
           method: 'POST',
           headers: { "Content-type": "application/json"},
           body: JSON.stringify(myVar)
        }).then(function(response) {
           status = response.status;  // Get the HTTP status code
           response_ok = response.ok; // Is response.status in the 200-range?
           console.log("Response: " + JSON.stringify(response));
           return response.json();    // This returns a promise
        }).then(function(responseObject) {
           // Do something with the result
           console.log('the API said: ' + JSON.stringify(responseObject));
        }).catch(function(err) {
           // An error occured parsing Json
           console.log('Error : the API said: ' + JSON.stringify(responseObject));
        });
      }

      module.exports = {
        loginPostData: loginPostData,
        username: username,
        password: password
      }

    </JavaScript>
    <StackPanel>
        <TextBox Value="{username}" />
        <TextBox Value="{password}" />
        <Button Text="ok" Clicked="{loginPostData}" />
    </StackPanel>
</App>

Hi Anders,

i fixed the code as mentioned the result: