View Full Version : Query string problem with XMLHttpRequest () object in sencha touch

Sameer Khan
10 Jan 2012, 1:22 AM
Hi, I have to send huge amount of data to .net server...So i created xml string and added as parameter to url and i was called send(null); using xmlhttprequest() object...But here problem in .net web.config file maxQueryStringLength is "2097151"..so i cann't post more than these characters...But here in my querystring i have morethan this size...

How to solve this problem...plz help me...

10 Jan 2012, 2:21 AM
Why don't you send it using POST action instead of GET?

Hope this helps

Sameer Khan
10 Jan 2012, 5:32 AM
var params="userId=patty";
xmlhttp.open('POST', 'http://localhost:4770/SERVICE-HANDLERS/ClientList.ashx', true);
//Headers to xmlhttprequest object
xmlhttp.setRequestHeader('Origin', 'http://localhost:4770');
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.setRequestHeader("Cache-Control", "no-cache");

xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200){
alert("URL Exists!");
else if (xmlhttp.status==404){
alert("URL doesn't exist!");
alert("Status is "+xmlhttp.status);

I have written like this...Can u plz let me know where i am doing wrong ?

But if i did like this control goes to webservice call, then it's working fine...

xmlhttp.open('POST', 'http://localhost:4770/SERVICE-HANDLERS/ClientList.ashx?userId=patty', true);

But i want to execute above one...bcz data will go inside of request body...

10 Jan 2012, 5:43 AM
Sorry, but why don't you use a simple Ext.Ajax.request?

url: 'http://localhost:4770/SERVICE-HANDLERS/ClientList.ashx',
method: 'POST',
params: {
'userId': 'patty'
scope: this,
success: <YOUR_SUCESS_FN>,
failure: <YOUR_FAILURE_FN>

Sameer Khan
10 Jan 2012, 5:46 AM
Bcz It won't support cross platform communication , i already tried with that...so i have chosen to work with XmlHttpRequest() object to send huge data from sqlitedb to .Net server in the form of xml string...

But here also i am facing some issue...

10 Jan 2012, 5:56 AM
So I assume your web application in running on localhost:80 ad you are trying to get your data from localhost:4770. Am I correct?

If for some reason you have to do that, until you don't move your backend on a production host, I suggest you to browse your app using the file:/// protocol instead of http://localhost.
So, just to be clear, double click on your index.html and try to make the request from the page on that url.

Sameer Khan
11 Jan 2012, 1:51 AM
Hi, what ever you said correct....And one more question is :

If i use xmhttprequest() object in sencha touch application, finally if i upload .apk file of my sencha touch application to android device and do upload then, XmlHttpRequest() object can perform communication with cross domain (i mean with .net application)

24 Nov 2014, 8:51 AM
Hello everyone ,

i am new in sencha touch. i was create a simple registration form for this i sent my data on sever request using ajax post method but problem is this request called two time so i got response that this data is already exist. another problem is when i merge sencha code phone gap and run on emulator post method is not allow me to send params on server side i also used jsonData but got same response.
here is my code .

url: 'http://www.preapps.com/test_snapplow.php',
method : 'POST',

params: {
email: 'some@gmail.com',
password: '1234567890123456' ,

callback : function(response, options,sample) {
//var data = Ext.decode(response.responseText, true);

failure : function(response, options,sample) {

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


scope: this

i also allow CORS in my server side here is the server side code :

/*here i placed header code for CORS*/
echo "Hello World" .$_POST['email']. "\n".$_GET['email'];