Ext.Ajax.request({
url: 'foo.php', // where you wanna post
success: passFn, // function called on success
failure: failFn,
params: { foo: 'bar' } // your json data
});
I am following How to post json data with extJS and got a question regarding functions. I see that we can embed functions right in the passFn and failFn area. However, what if I want these functions to be elsewhere? Where to create these functions and code them in Sencha Architect?
You can create a folder that is outside of Sencha Architect control, and call it from inside your Architect code.
For example, I like to create a folder called “util”. So here is what your folder structure will look like:
Inside MiscFunctions.js, you would create the class like so:
Then you can refer to those functions from inside your Architect code:
Don’t forget to add the
part, or else you will have to create an instance of that class to use the functions inside.