Hi,pleasure to meet you all.I wanna to ask how to write a javascript code to connect with php api authentication located at my server(eg. www.mydomain.com/api/index.php).
1.I wanna put a javascript code to call the api authentication function at my website server so that other people can access through the api key provide by my website.
eg location script www.mydomain.com/api/script/access.js
2.the access.js will call to my server's api(www.mydomain.com/api/index.php),do the authenticate api process and return the result back to client side(if not valid api key,don't allow return result data to the client side.
3.so, how do i write the javascript code to put at www.mydomain.com/api/script/access.js(this script need to call the api key authentication class that located at my server)?is that i can use the cookies of the client side to detect again the user data when the user next time access the access.js?
4. how to i write the api key authentication class at my www.mydomain.com/api/index.php so that only valid api key user can access the result data?
Note:www.mydomain.com/api/script/access.js can be access through embeded into html format like this
<script src="www.mydomain.com/api/script/access.js?key=ADD_YOUR_KEY_HERE" type="text/javascript"></script>
Note:Kindly give simple code so that i can more understandable on the flow.
Note:thanks for all guys help solve my problem!!!:)