Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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

http://pastie.org/973616

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
— asked May 23rd 2010 by Stephen Gilboy
  • ajax
  • json
0 Comments

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.

    — answered May 23rd 2010 by Sj Singh
    permalink
    0 Comments
  • 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

    — answered May 28th 2010 by Carlos Mosqueda
    permalink
    0 Comments
  • 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 :)

    — answered May 28th 2010 by Stephen Gilboy
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.