Thought I would share some code (remote Ajax call that's more jQuery-like)
Good afternoon everyone…
I don't see enough code samples provided in here, and since there is no forum for it or a way to edit the documentation, I thought I would use here to share a piece of wrapper code I put together to handle making remote Ajax calls more like I am used to
that's just easier to call and consume the returned data (note: in JSON format) if you are like me and are more used to jQuery
of course make sure you put the Ajax.Get function in some sort of included .js files, which hopefully you are doing for common functionality anyways and use
Ti.include("commonfile.js");
to make it available…
I also haven't included some sort of block/modal to stop the user from taking action while it's running
- Stephen
4 Answers
-
Awesome! I did something similar but yours look a lot better. This really does help clean up the code a bit! Thanks for sharing the code.
-
I can not thank you enough for this. I have been looking for something like this for a while from even Appcelerator. Their documentation is not the best. I think we need step by step tutorials on how to do just simple things like this.
One question. How can you output the data onto the screen? I tried a createTableView and add the table view to the window getting the data:Ajax.Thanks
-
hmm… i've never tried to bind the resultant JSON right to an object, but i wouldn't see any reason that as long as the JSON key names from the server matched what the TableView was looking for why it wouldn't work.. a JSON object is a JSON object, no matter how it was created :)
-
I recently made one that is a lot more jQuery-like:
http://www.vancelucas.com/blog/easier-titanium-xhr-and-ajax-requests/