lundi 24 novembre 2014

Ajax called twice and unable to send params on (phonegap+sencha) xcode emulator

Hello everyone,

i am new in sencha touch. i was created a simple registration form and want to send my data on server side using Exr.AJAX.Request , POST method but on each button tap ajax will called twice and when i merge my code with phonegap and run it on emulator ,POST (method) params are not sent on server side but get method is working on emulator.

here is my code :


Ext.Ajax.request({

url: 'http://ift.tt/1zl5JjM',

method : 'POST',

//also used jsonData instead of params

params: {

email: 'some@gmail.com',//efbuserResults.email,

password: '1234567890123456' ,//fbuserResults.id,


},

callback : function(response, options,sample) {

//i also tried success function

//var data = Ext.decode(response.responseText, true);

debugger;

alert('success');

alert(sample.responseText);


},

failure : function(response, options,sample) {

alert('fail')


// var data = Ext.decode(response.responseText);

debugger;


alert(response.responseText);


},

scope: this

});


},


i also set my server to allow CORS .i already spent 3 days for this but didn't get any solutions here is server side code:


<?php


/*here i placed CORS header */


echo "Hello World" .$_POST['email']. "\n".$_GET['password'];

?>


same data will save two twice.i can handle it on sever side condition but can any one tell how could control this ajax call.


Screen Shot 2014-11-24 at 10.20.02 pm.jpg






Ajax called twice and unable to send params on (phonegap+sencha) xcode emulator

Aucun commentaire:

Enregistrer un commentaire