-
16 May 2012 3:31 AM #1
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:
please how can i fix that ??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);
thank you
-
18 May 2012 6:34 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,637
- Vote Rating
- 435
- Answers
- 3106
Is it being called? Is the if statement stopping it?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
18 May 2012 12:38 PM #3
nothing has occured when i press the button.
-
18 May 2012 3:31 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,637
- Vote Rating
- 435
- Answers
- 3106
I would suggest setting a breakpoint to follow your code to see what is happening.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
22 May 2012 1:35 AM #5
SALAM.
when i changed the Ext.util.JSONP.request function to
the failure: function work and the message appear with only the word "error" without the status.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 url is correct because i try it in my browser and it's work corectly.
i don't know what to do ??


Reply With Quote