Okay obviously in this situation using an ajax
call would be the answer. But I have a few questions in the process.
I am preparing to build a mobile app with cordova, and I want to fetch data with javascript. All day today I have been working with laravel and creating some data to store in the database. After creating a router and a controller I see I can access the data in my database as a json object via a uri, this is very cool. Something like http://localhost/players
and I get an object.
This is quite similar to the facebook api https://graph.facebook.com/195466193802264 if I were working with the facebook api, inside my javascript I would make an async call to that uri above, obviously the facebook api is more complex with permissions and tokens.
My question is since I setup my uri http://localhost/players
, have I created a basic api that I can make a call to that uri and feed my app? Because that is what I will need, it will obviously be in a completely different location than where my laravel is, because I mean it does get packaged into a .apk and installed on the device.
I feel like I am on the right track and I am getting the hang of it, but come the day I need to build my app I want to understand how to consume that data without having to use PHP or be inside that directory.
What I am asking is that true or false, am I thinking wrong here? If so, I can handle saving data but how do I consume this data from an external project?