# Off-Topic Discussion > The Lounge > Tech Talk >  >  Pass Variables Between JavaScript and C++/Python?

## youssarian

I've been using these languages for quite some time now. I want to apply my skills by making a browser-based JavaScript game, albeit probably a simple one to start off with, but I want to be able to save the data (like any modern game has). Unless I'm mistaken, PHP is a server-side language that wouldn't save data on the player's machine. JavaScript has the FileScriptObject as part of the ActiveX, but I think I should stay away from that since it's proprietary and won't work in some browsers.

So without learning any new languages, I figure my best options are C++ and Python. But, how can I pass data from JavaScript code to a C++ or Python program?

Thanks!

(Addition: I'm also pretty good in PHP, too)

----------


## Ynot

C++ or python won't help you very much for a browser based game

Why not just store any save game data in a cookie?

----------


## khh

If you need to store variables in your server, you could use AJAX or something to communicate with the server, and store the data in a database or something. It shuold be possible to do with Python, but I think it would be easier with PHP.

----------


## youssarian

The thing is, PHP and Python would store the data on the server's side. I'm trying to find a way to save the information on the client side, so that I don't get all sorts of little and not-so-little saved game data on the server. (I use a webhost and I have limited disk space allotted to me.)

----------


## khh

Oh. Well, if you want to save data client side, then using cookies is your best bet. Like Ynot said.

----------


## youssarian

That's embarrassing. Somehow in my reading of replies I missed the cookie part.

----------


## L815

Cookies would work but can be a pain to implement since they are deleted every so often, so holding lots of data isn't always good.

I'd say hold only the most important and crucial data on the server, load that up into the session, and then use some clever javascript/ajax to generate the rest of the data, client side.

----------

