1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
    zied jouini is on a distinguished road

      0  

    Default Unanswered: JSONP request

    Unanswered: JSONP request


    SALAM all.
    i'm trying to consume restful web service made with .NET WCF here is a link to my web service
    "http://localhost:8732/log/log/admin/pass/admin"
    i'm using sencha touch to made a mobil cross app.
    so i tryed to consume this web service with sencha touch1 but without success.
    please have you some code ? and how can i call the Ext.util.jsonP in my form
    here is my from:
    Code:
    App.views.BankingLogin = Ext.extend(Ext.Panel, {
     scroll: 'vertical', 
       items: [{
     xtype: 'formpanel',
     id: 'form',
     fullscreen: true,
     cls : 'form',
    
    
      items: [
    {
               xtype: 'fieldset',
               title: 'Sign In',
    },
    {
                xtype: 'textfield',
                id : 'Login',
                label: 'Login*',
                placeHolder: 'login',
                },
            {
                 xtype: 'passwordfield',
                 id: 'password',
                 label: 'Password*',
                 useClearIcon: true,
                 placeHolder: 'password',
                },
                
                {
                 xtype: 'panel',
                 defaults: {
                             xtype: 'button',
                             style: 'margin: 0.1em',
                             flex: 1
                           },
                 layout: {
                          type: 'hbox'
                         },
                 items: [{
                          text: 'Valider',
                          handler: function() {
                        if (Ext.getCmp('Login').getValue() == '') {
                          Ext.Msg.alert('Impossible de se connecte', 'Login vide');
                          }
                          
                          if (Ext.getCmp('password').getValue() == '') {
                          Ext.Msg.alert('Impossible de se connecte', 'mot de passe vide');
                          }
                          
                          if (Ext.getCmp('password').getValue() == '' && Ext.getCmp('Login').getValue() == '') {
                          Ext.Msg.alert('Impossible de se connecte', 'Login & mot de passe vide');
                          }
                          
                          if (Ext.getCmp('password').getValue() != '' && Ext.getCmp('Login').getValue() != '') 
           {
    
    
    Ext.util.JSONP.request({
        url: 'http://localhost:8732/log/log/admin/pass/admin',
        success: function (resp) {
            var data;
            data = Ext.decode(resp.responseText);
            if (data.success === true) {
                Ext.MessageBox.alert('Message', data.msg);
            } else {
                Ext.MessageBox.alert('Error', 'Some problem occurred');
            }
        },
        failure: function () {
            Ext.MessageBox.alert('Error', 'Some problem occurred');
        }
    });
                    Ext.Msg.alert("Bienvenue ",App.views.BankingLoginrequest.data.msg );
                    Ext.redirect('Banking/compte');
                    window.location = redirect;
                                }
                                              }
                        }]
                },
    
    
                  ]
    }]
    });
    Ext.reg('BankingLogin', App.views.BankingLogin);
    please how can i fix that ??
    thank you

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Answers
    3452
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is it being called? Is the if statement stopping it?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
    zied jouini is on a distinguished road

      0  

    Default


    nothing has occured when i press the button.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Answers
    3452
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I would suggest setting a breakpoint to follow your code to see what is happening.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
    zied jouini is on a distinguished road

      0  

    Default


    SALAM.
    when i changed the Ext.util.JSONP.request function to
    Code:
    Ext.Ajax.request({
       url: 'http://localhost:8732/log/log/admin/pass/admin',
      success : function(response, opts) {
          var obj = eval('('+ response.responseText+ ')');
          Ext.Msg.alert("welcom ",obj);
         alert("entre dans la fonction succe");
       },
      failure: function(response, opts) {
          Ext.Msg.alert("error ",response.status); 
     }
     });
    the failure: function work and the message appear with only the word "error" without the status.
    the url is correct because i try it in my browser and it's work corectly.
    i don't know what to do ??

Thread Participants: 1

Tags for this Thread