View Full Version : wait jsonstore for action!!

9 Mar 2010, 5:57 AM
i call a jsonstore
and i would like to use it after
but the code doesnt wait result to begin action !!

why ?

9 Mar 2010, 6:00 AM
What does the important warning on the API docs for the load method tell you?

You have of course read it haven't you?

9 Mar 2010, 6:10 AM
i read it
but i tried to pass through a success methode but it doenst works
he never see the success return

9 Mar 2010, 6:22 AM
The docs for load even give you a link to where to look at to do what they suggest!

Are you seeing something different to me?

9 Mar 2010, 6:28 AM
If you posted a little bit of code it would help us to narrow down whats wrong.

Mike Robinson
9 Mar 2010, 6:59 AM
Do this:

(1) Go to the ExtJS demos page and choose one of the examples that uses a JSONStore. Look at the source-code. Your code needs to look exactly like that.

(2) Now use Firebug ("Network" tab) to look at the so-called "XHR" exchanges that are taking place between the demo code and the server. The packets sent by your host need to look exactly like that.

(3) Always remember that 'AJAX works by mailing postcards." You write your message on a postcard and drop it into the mail box. Then, you don't just stand around waiting for the reply to come. You go and do something else. Eventually, a response will come back. You see, you wrote two mailing-addresses onto that postcard: one for success; the other one for failure. Eventually, your postcard (with a reply written on it...) will show up at one or the other of those two addresses. In human terms, it might be weeks, months, even years from now. But, it will come.

9 Mar 2010, 7:06 AM
in my php file i get my sql result and send it like that :


echo json_encode($semtab);

and in my js file :

success: function(f, a){
failure: function(f, a){

and i never see success !!!

9 Mar 2010, 7:28 AM
You did not read the docs. You didn't. It shows. "success"? Where IN THE DOCS FOR "load" is that mentioned?

9 Mar 2010, 7:31 AM
can you tell me wich examples have a jsonstore with success en failure method??

because i found with jsonstore and doesnt seem different than mine

9 Mar 2010, 7:32 AM
What are you having difficulty with?

The documentation for load is crystal clear.

9 Mar 2010, 7:37 AM
i look a the XHR
i see my array
like the POST in console
dont see the difference...

i dont understand why it so difficult to pass data like that...

9 Mar 2010, 7:43 AM
crystal clear .... ???

is there an example in examples section name crystal clear ???

i certainly not a the same place than you ...

9 Mar 2010, 8:14 AM
Please look at the 'load' method documentation here...


In the 'parameters' section you will see...

callback : Function

A function to be called after the Records have been loaded. The callback is called after the load event is fired, and is passed the following arguments:

The 'success' and 'failure' are not options in the 'load' method, there is only one 'callback' option that is fired upon a load.

10 Mar 2010, 12:23 AM
ho thank you
i ve got an answer after the result of my query now!!!!


now i try to retrieve the array i transmit in json :)