私はSencha Touch 2を使用してアプリケーションを作成していますが、Webからアクセスするとうまく動作します。問題は、iPhone用にビルドし、ローカルURL(../services/myservice.php)からリモートURL(http://remoteurl.com/services/myservice.php)に変更したときです。Sencha Touch 2でJsonPを使用してフォームを送信するには?
私は、クロスドメインエラー入門:
**XMLHttpRequest cannot load http://example.com/services/userRegister.php?_dc=1336972603884. Origin http://localhost is not allowed by Access-Control-Allow-Origin.**
をそして私はJSONP使用してフォームを送信する方法があればお聞きしたいと思いますので、私はもうこの問題はありません。ここで
は、フォームの私のコードです:
Ext.define('RegistroMovil.view.Register',{
extend: 'Ext.form.Panel',
xtype: 'register',
requires:[
'Ext.form.FieldSet',
'Ext.form.Email'
],
config: {
title: 'Register',
iconCls: 'user',
url: 'http://example.com/proys/congreso/services/userRegister.php',
items: [
...
そしてフォームを送信するボタンのコード:
{
xtype: 'button',
text: 'Register',
handler: function(){
this.up('register').submit({
success: function(f, a){
alert('Your id: ' + a.id);
f.reset();
}
});
}
},
はどうもありがとうございました!