PDA

View Full Version : Just simple response - [Solved]



Gauser
16 Mar 2009, 9:47 AM
Hi there

Here is my first post, so just "Hi" to everybody.

I have a quite simple problem.
I need to do a simple "server ask" and, in case of response (true or false) just call some function, in Ext.onReady(function(){ }); body. The perfect solution is when a "asking" block working in loop, like setTimeOut.

How should I do this ?

Greets, and thanks!

16 Mar 2009, 10:38 AM
howdy dude.

Server Request?? You can use Ext.Ajax.request.

check http://extjs.com/learn/

Gauser
18 Mar 2009, 11:25 PM
Hi

I found solution. Quite simple server ask - response:

Client:


<script>
Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

Ext.Ajax.request({
url : '_resp.php' ,
params : { action : 'getDate' },
method: 'GET',
success: function ( result, request ) {
Ext.MessageBox.alert('Success', 'Data return from the server: '+ result.responseText);
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
}
});



});
</script>


and server:



<?php
# _resp.php
if ($_REQUEST['action'] == 'getDate') {
echo date('l dS \of F Y h:i:s A');
}


?>


Maybe helpfull for someone.