View Full Version : AJAX Database Help

19 Jul 2010, 10:41 AM
Hey guys! Sorry to bother you all, but I was trying to look through the examples on the Sencha Touch site, and searched a bit through the forums, but couldn't find what I was looking for.

I was wondering if there was a simple example out there of reading/writing to a database through AJAX using Sencha Touch.

For a basic example:
1) Type number into text box in Sencha Touch.
2) Press submit button. This sends data to the database without refreshing/reloading the page.
3) Press another button (say "Get"). This reads the last entry from the database without refreshing/reloading the page.

I don't need mysql code or the php file that would deal with this if needed. I just wanted to know what the Javascript/Ext.JS/Sencha Touch method would be of dealing with pushing/receiving data through AJAX so that I can accomplish this.

Thanks so much guys in advance! Your help is greatly appreciated.

19 Jul 2010, 11:01 AM
2/3 are basically Ajax requests, if you check out examples/ajax it should set you on the right path.

19 Jul 2010, 11:57 AM
var makeAjaxRequest = function() {
url: 'test.json',
success: function(response, opts) {
Ext.getCmp('status').setTitle('Static test.json file loaded');

Would I replace the url with say, a php file containing the code I want to execute? (in essence, if that's the case, would it allow for variables such as "index.php?p=this" in the url slot?)

Also, what is "response.responseText"

I'm just having trouble understanding the code presented in the ajax example.