Käynnissä

Write ajax variable to txt file with php

1

down vote

favorite

I have a facebook application coded client side and I want to store the tokens on my server for later use

There is a variable called 'token' and I then create a new function called 'apple' to write this variable in a json format to a txt file

$(document).ready(function(){

$("#submit").click(function(){

//access token stuff

var token = $("#link_input").val();

//alert("Got Token: " + token + ". your application token");

if ([url removed, login to view]('#access_token=')[1]) {

var token = [url removed, login to view]('#access_token=')[1].split('&')[0];

//alert(token);

function WriteToFile(apple)

{

$.post("[url removed, login to view]",{ 'token': apple },

function(data){

alert(data);

}, "text"

);

return false;

}

My php file

<?php

$thefile = "[url removed, login to view]"; /* Our filename as defined earlier */

$towrite = $_POST["token"]; /* What we'll write to the file */

echo $towrite;

$openedfile = fopen($thefile, "w");

$encoded = json_encode($towrite);

fwrite($openedfile, $encoded);

fclose($openedfile);

return " ".$towrite;

?>

but i cant get it to write anything

Taidot: Javascript, MySQL

Näytä lisää: ajax write text file, ajax write file server, ajax php write file, write file, w split, create application with php, w-9 what is it, val , txt, php encoded, json and mysql, javascript with php, data to text file, apple w, json client, split file, ajax mysql php vote, mysql php ajax vote, ajax write text, php json write, return file, post json, fwrite, write json file server, encoded php

About the Employer:
( 18 reviews ) berkeley, United States

Projektin tunnus: #4277282

Myönnetty käyttäjälle:

prakharkumar610

Piece of cake. Let me help you with this!

30 $ USD 1 päivässä
(5 arvostelua)
3.6

3 freelanceria on tarjonnut keskimäärin 53 $ tähän työhön

scriptphp87

Hello Please read more than private message thank you

100 $ USD 1 päivässä
(18 arvostelua)
5.1
PrajwalShetty

I have 6 years of experience in developing applications using jquery,php,mysql. i have also good experience in facebook graph apis.

30 $ USD 0 päivässä
(25 arvostelua)
4.7
eblive

Hi, I can help you out.

100 $ USD 3 päivässä
(0 arvostelua)
0.0