# The button "logIn "  don't fire my method   

**URL:** <https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426>\
**Category:** How-to Discussions\
**Created:** [June 26, 2016, 11:49pm UTC](https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426 "2016-06-26T23:49:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibrahem9311](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@ibrahem9311](https://forums.fusetools.com/u/ibrahem9311)\
**Post date:** [June 26, 2016, 11:49pm UTC](https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426/1 "2016-06-26T23:49:56Z")

</div>

I tried to make a login screen the user enter his username & pass , and posting the entered data to my server .

but when the button " Login " is pressed nothing done . I want to know what i missed .

here the code in JS

```auto
 <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
        }

     </JavaScript>

```

and UX

```auto
<MyPage ux:Name="logpage" ux:AutoBind="false">

          <Image File="Assets/Car2.jpg" Layer="Background" StretchMode="UniformToFill" StretchDirection="Both"/>  
            <Grid Rows="1*,1*">
                <StackPanel Alignment="VerticalCenter">
                    <Text Alignment="HorizontalCenter" FontSize="33"> Car Care Application</Text>
                    <Text Alignment="HorizontalCenter" FontSize="10"> Welcome Sire Your car with the safely Hand</Text>
            </StackPanel>
            <StackPanel Alignment="VerticalCenter">
              <!-- User name input -->
                <TextInput PlaceholderText="user name" Value="{username}" Padding="10"/>
              <!-- Password input --> 
                <TextInput PlaceholderText="password" Value="{password}" IsPassword="true" Padding="10" />
                <!-- log in Button -->
                <Button Text="LogIn" IsEnabled="{vis}" Padding="10" >
                  <Clicked Handler="{loginPostData}" />
                </Button>
                <Switch />
                <Text Alignment="HorizontalCenter" FontSize="10">Remmber me</Text>
                <Button Text="Go Back" Width="1" Height="1" IsEnabled="{vis}" Padding="10">
                <Clicked>
                    <GoBack />
                </Clicked>
            </Button>

            </StackPanel>
        </Grid>
    </MyPage>

```

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [June 28, 2016, 9:14pm UTC](https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426/2 "2016-06-28T21:14:42Z")

</div>

Hi,

Where is this JavaScript tag in relation to the rest of the code?

---

<div class="post-metadata">

**Author:** ![ibrahem9311](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@ibrahem9311](https://forums.fusetools.com/u/ibrahem9311)\
**Post date:** [June 29, 2016, 4:38pm UTC](https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426/3 "2016-06-29T16:38:57Z")

</div>

Hi,

It’s exist in the MainView.ux file .

Thanks .

---

<div class="post-metadata">

**Author:** ![ibrahem9311](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@ibrahem9311](https://forums.fusetools.com/u/ibrahem9311)\
**Post date:** [July 2, 2016, 8:51pm UTC](https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426/4 "2016-07-02T20:51:03Z")

</div>

Here : [https://www.dropbox.com/s/6jyhooxhg0ti5ew/Project20%2B6%2B2016.rar?dl=0](https://www.dropbox.com/s/6jyhooxhg0ti5ew/Project20%2B6%2B2016.rar?dl=0)

you could find the all project .

---

<div class="post-metadata">

**Author:** ![Remi\_Pedersen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/remi_pedersen/32/432_2.png) [@Remi\_Pedersen](https://forums.fusetools.com/u/Remi_Pedersen)\
**Post date:** [July 3, 2016, 6:29pm UTC](https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426/5 "2016-07-03T18:29:38Z")

</div>

You have typos in your javascript: `require"FuseJS/Observable"` should be `require("FuseJS/Observable");` and there’s a missing “v” in `Obserable("");` a few lines below.

Fixing those two gave me the expected HTTP response when logging in.

Also, I strongly recommend that you migrate your project to [the latest version of Fuse](https://www.fusetools.com/downloads)

---

<div class="post-metadata">

**Author:** ![ibrahem9311](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@ibrahem9311](https://forums.fusetools.com/u/ibrahem9311)\
**Post date:** [July 12, 2016, 11:39am UTC](https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426/6 "2016-07-12T11:39:38Z")

</div>

Hi,

I fixed my code , and installed the latest version 0.21. but i have the same problem

clicked don’t work .

---

<div class="post-metadata">

**Author:** ![Remi\_Pedersen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/remi_pedersen/32/432_2.png) [@Remi\_Pedersen](https://forums.fusetools.com/u/Remi_Pedersen)\
**Post date:** [July 13, 2016, 8:13am UTC](https://forums.fusetools.com/t/the-button-login-dont-fire-my-method/2426/7 "2016-07-13T08:13:05Z")

</div>

Then I recommend that you try to create a minimal test case which reprodues the issue with as little code as possible, to make it easier to debug.

Also:

- What platform(s) are you testing on
- And which exact behavior are you expecting when you click on the button? (As mentioned I got an HTTP response)
