I need to call some Javascript that grabs data from the Twitter API on script load and then sends the data to POST. It is not attached to a UI and the action is automatic on script load.
What is the best way to approach this? Do I call a view with the AJAX script in it or is there a better, more conventional way to handle this in codeigniter? Links and examples welcome.
From what I know, business logic isn’t supposed to be in the view. All the script does is process data. So where do I put this AJAX script?
If you are doing it on the client side, even if it’s just data processing (how you are processing data on the client btw?), the HTML/javascript I’d say belongs in a view. Also, are you sure you want your twitter API creds out there for everyone to see? If someone hijacks that it could break your app when they start overloading the API user account and lock it out by doing too many requests.