https://github.com/jmcerrejon/appcelerator
Appcelerator resources I built. See http://appcelerator.com
https://github.com/jmcerrejon/appcelerator
Last synced: 3 months ago
JSON representation
Appcelerator resources I built. See http://appcelerator.com
- Host: GitHub
- URL: https://github.com/jmcerrejon/appcelerator
- Owner: jmcerrejon
- License: gpl-2.0
- Created: 2015-07-16T06:27:03.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-19T10:48:12.000Z (about 10 years ago)
- Last Synced: 2025-01-30T15:40:55.001Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 262 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Appcelerator
Appcelerator resources I made. See http://appcelerator.com**jmHelper.js:** Some useful functions in a js file:
*isJSON(obj)* : Check if an object is a jSON.
*getData(url, _callback)* : Get jSON data from GET request.
*postData(url, obj, _callback)* : POST data to an url specified.
*listViewJSon(url, obj, _callback)* : populate a ListView element (obj=id) through a jSON petition.
**Examples**
```
var helper = require('jmHelper');
helper.postData("http://posttestserver.com/post.php", temp, function(_response) {
(_response.success) ? alert("Perfect!") : alert('F·$k!: ' + _response.error);
});helper.getData("http://api.randomuser.me/?nat=es", function(_response) {
(_response.success) ? alert(_response.data.results[0].user.name.first) : alert('F·$k!: ' + _response.error);
});
helper.listViewJSon("http://misapuntesde.com/listview_ex.json", $.elementsList, function(e) {
// get the clicked section
var section = $.elementsList.sections[e.sectionIndex];
// get the clicked item from that section
var item = section.getItemAt(e.itemIndex);
// print the item's title
Ti.API.info('itemclick: ' + item.properties.title);
});
```