I have been working on a small part of a FB Graph API project .
basically there is this function that does something(thats a really vague discription .. i know lol .. nevermind) .
- function testAPI() {
- console.log('Welcome! Fetching your information.... ');
- FB.api('/me', function(response) {
- console.log('Successful login for: ' + response.name);
- document.getElementById('status').innerHTML =
- 'Thanks for logging in, ' + response.id + '!';
- });
-
- //dynamic updation needed .
- FB.api('/676713385757366',function(response) {
- alert(JSON.stringify(response));
- });
now if you look at the second last line I.E
- FB.api('/676713385757366',function(response)
The Unique ID is Immediately after the slash /.
Now i need that particular id to be dynamically inputted instead of it being predefined in the code .
What do i mean by dynamically ?? well look at the code below .
- <form action="http://www.purplefront.net/FacebookData/getdata.php" form id="idform">
- <p>
- <label for="facebookid">Enter Id:</label>
- <input name="facebookid" type="text" required="required" id="facebookid">
- </p>
- <p> </p>
- <p>
- <input type="submit" name="submit" id="submit" value="Submit">
- </p>
- </form>
now whatever the user inputs in the input area , is what needs to be dynamically Updated after the "Slash" in the function code .
i know for a seasoned programmer that wld be a cakewalk task , but hmmm , i am having trouble .
let me discuss my solution ::----
Well i have all the HTML , JS , PHP code on one page , since it a farely small app .
also , i donno if i can come up with a pure PHp solution to this , but since lately i have done a bit of coding in JS , i would prefer a JS or Jquery only solution.
I think i will have to use a variable and the JQuery Val() function.
I browsered and found a few helpful resources . Like :
While i work on the solution , i taught i'd post my problem :D
ok , will go do sm more research now . :))