PDA

View Full Version : document.location Ext.Ajax.request



Madiyana
19 Nov 2012, 6:07 AM
Hi,
I try to change one function for addind Ext.Ajax.Request but I hava a promblem with my url ..
In my function I use document.location = '' and when i take the 'url' and add it in the Ext.Ajx.Request ,
My function :
PS : I take just a part in my function , the part where I do it


if(btn=='yes'){
var box = Ext.MessageBox.wait('Traitement en cours ...');
var arrayIds = [];
Ext.each(grilleResultat.selModel.getSelection(), function(e){
arrayIds.push(e.data.Id_Amn);
});
var jsonLstIds = Ext.JSON.encode(arrayIds);
document.location = '/gedeo/amenagement/genererpdf/array/'+jsonLstIds;
box.hide();
}
},


And this code with Ajax



if(btn=='yes'){
var box = Ext.MessageBox.wait('Traitement en cours ...');
Ext.Ajax.request({
url : '/gedeo/amenagement/genererpdf/array/'+jsonLstIds,
params : { jsonLstIds : jsonLstIds },
success : function(response, opts){
box.hide();
},
failure : function(response, options){

}
});
// document.location = '/gedeo/amenagement/genererpdf/array/'+jsonLstIds;
}


If someone can help me Pliz.;
Thanks

Madiyana
19 Nov 2012, 7:20 AM
For reformulate my question,

How can we use document.location in Ext.Ajax.Request .?


Ext.Ajax.request({
url : '/gedeo/amenagement/genererpdf/array/'+jsonLstIds,
//document.location = '/gedeo/amenagement/genererpdf/array/'+jsonLstIds;
params : { array : jsonLstIds },
success : function(response, opts){
box.hide();
},
failure : function(response, options){

},

mitchellsimoens
21 Nov 2012, 8:04 AM
Have you looked at what document.location gives you? It's not a string

Madiyana
21 Nov 2012, 8:18 AM
Thx , Sorry I am new in ExtJS4 so I get some problem
So, there is no solution for doint 'document.location ' in Ext.Ajax.Request.;
I need it

Thx

mitchellsimoens
21 Nov 2012, 8:20 AM
There definitely is, open up the dev tools of your browser and in the console type document.location and expand it to see what it has. It's basically an object. So you can do document.location.origin for example.

Also, this isn't Ext JS code, this is native javascript.

Madiyana
21 Nov 2012, 8:26 AM
Ok Thx