views:

215

answers:

1

Hello everyone!I have a grid what update my database (via PHP) with JSON record. I want to know, how the data writed - record or not. I have an answer from PHP (true or false) to the grid, but dont know how to use it. How my grid can use this answer? (success event?)

Now, for example, User added new record without id at database (and i need this id for the future update), php answer what record saved(true) and told me id of new record. How I should work with it?

And I saw somehere some beauty flowing from the top of screen windows - how do the called? Sorry for typically questions, but I cant find answer for it.

Thanks.

A: 

If you are using Ext.Ajax.request to make the connection this is how you do it.

Ext.Ajax.request({
   url: 'ajax_demo/sample.json',
   success: function(response, opts) {
      var obj = Ext.decode(response.responseText);
      console.dir(obj);
   },
   failure: function(response, opts) {
      console.log('server-side failure with status code ' + response.status);
   }
});

There is a success callback function you specify which gets the response from the server which is a JSON object. This is where you can send things back and then manipulate your roweditor grid however you like.

Success also doesn't mean that everything went ok, it just means the request did not produce an html error code 4xx or 5xx.

The failure callback function is what to do if the server returns an error code for the AJAX request.

David Young
thanks a lot - try it instead httppoxy
0dd_b1t