Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » Saving values on a web server...
Search Topic:
Uniqs:
171
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
Javascript - parse xml string »
« Not sure why?  
AuthorAll Replies


Vamp
5c077
Premium
join:2003-01-28
MD
·Verizon FIOS

Saving values on a web server...

What is the easiest way to go about saving certain values to a web server so that it is interactive between users (changes reflected on both ends) on the page? It also needs to be able to handle many simultaneous requests.

--
WLM/MSN Messenger: scott001(gmail) ADD ME!


PetePuma
How many lumps do you want
Premium,MVM
join:2002-06-13
Arlington, VA
YOu need to be more specific about what you're asking. That's a really vague question. What kind of app, specifically, are you talking about?


Vamp
5c077
Premium
join:2003-01-28
MD
Oh sorry.. Nothing in particular, just saving values so they are accessible with javascript.

--
WLM/MSN Messenger: scott001(gmail) ADD ME!


Symcrapico

join:2002-08-08
Canada
clubs:
reply to Vamp
Well, first of all, JS is client-side, so your gonna need to have some sort of server-side language/code. I'd suggest PHP/MySQL since its kinda easy to learn.

You could also use cookies, but I'm not really familiar with that.

Cheers


Vamp
5c077
Premium
join:2003-01-28
MD
·Verizon FIOS

Well I know that but I know nothing about using PHP/MySQL (other than forums)... Cookies wont work because it has to be stored globally not just for that user pref.

So I need a way to save/retrieve values using PHP, but also be able to get those values into Javascript strings (can't use PHP).

--
WLM/MSN Messenger: scott001(gmail) ADD ME!

muiredised
ESSE QUAM VIDERI

join:2007-06-11
Tacoma, WA

reply to Vamp
You may need to brush up on the CGI (common gateway interface) protocol for some background. You will need to choose a server side language that will receive and process the data prior to actually saving it. Perl, PHP, Ruby, Python, and C are all viable choices. (my apologies if I omitted someone's favorite)

Once you have chosen a language you will author a script/program that will receive the data from a client, process it if necessary, and then store it on the server. Choices for storage are many. You can store it in a plain text file, a database, or one of many other formats. For very simple data that needs to be accessible from javascript only then perhaps your server-side script can format the data as javascript and save to a .js file. Then the client code can make an AJAX request for this file, eval it, and update whatever you got going on there on the client side.

The server-side language choice often comes down to a matter of personal preference. The actual storage method should be determined by the sophistication of the application and how the data is going to be used (need search capabilities?).

Typically PHP is thought of as an easy-to-learn server-side language so maybe start there and I'm sure you will find answers to questions as they arise.


Vamp
5c077
Premium
join:2003-01-28
MD
·Verizon FIOS

reply to Vamp
Ok I got PHP reading/writing to a txt file but there is an issue, this cant work because it can't be used in conjunction with Javascript statements... Not willing to rewrite everything (plus some things cant be rewrite as they are linked to another outside script).

Will probably just abandon the project.
--
WLM/MSN Messenger: scott001(gmail) ADD ME!


PetePuma
How many lumps do you want
Premium,MVM
join:2002-06-13
Arlington, VA

If you'd provide some more detail on what's involved perhaps you'd get a better answer. You keep mentioning some existing app (though you say you aren't interested in anything in particular -- I disagree; you have a specific application in mind) but don't provide any details. There is probably a viable solution but the crumbs you're throwing aren't enough.

muiredised
ESSE QUAM VIDERI

join:2007-06-11
Tacoma, WA

reply to Vamp
said by Vamp See Profile :

Ok I got PHP reading/writing to a txt file but there is an issue, this cant work because it can't be used in conjunction with Javascript statements...
What follows is a solution that is NOT ideal but without any details it is basically a proof of concept for you.

I write a PHP script that takes some user input, processes it, then writes it to a file in the following format:

var a = "user input";
var b = {test1:"more user input",test2:"look at me"};

The PHP script names the file "test.js" and saves in a directory that is accessible via the web. Now in your web page you include Javascript code that makes an AJAX call to »your.website.com/test.js (or wherever you saved it) and it fetches your file as a string. You eval the string and because the string is formatted as Javascript VIOLA!!! you now have data in your client side script that came from the server. Add more Javascript to use that data in whatever manner you wish, add a setTimeout to run the AJAX request at a specified interval and there you go.

I won't harp on the pitfalls of eval and what not. If you've never done anything like this before then you definitely have a learning curve ahead of you.


Vamp
5c077
Premium
join:2003-01-28
MD
Wow I never thought of that, that should work... I have experience with storing values in js and property files with Javascript... Just never touched PHP before like I said.
--
WLM/MSN Messenger: scott001(gmail) ADD ME!


usa2k
Please PRAY for Rebekah
Premium,MVM
join:2003-01-26
Canton, MI
clubs:
 Re: Saving values on a web server...

Best jump-start I had for PHP was
Here
Forums » Tech and Talk » OS and Software » Webmasters and DevelopersJavascript - parse xml string »
« Not sure why?  


Sunday, 08-Nov 19:39:51 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.
page compression OFF
Most commented news this week
· [156] Cable Uncapper Faces Criminal Charges
· [140] AT&T Sues Verizon Over 3G Ads
· [112] Why Run Fiber When You Can Run Ads That Pretend You Do?
· [108] Comcast Is Simply Getting Huge
· [93] Apple Cooking Up New $30 A Month TV Service?
· [83] Bits Of ACTA Agreement Leaking Out
· [80] Will 'Three Strikes' Come To The United States?
· [78] Verizon To Double Smartphone ETFs?
· [76] Verizon: Droid Tethering Will Cost $30 Extra
· [73] Comcast, NBC Deal Almost Complete
Most people now reading
· My cat is reluctant to exercise. [General Questions]
· Hit and run [General Questions]
· [Rant] Brand New 'Jasper' Xbox360 - RRoD Hardware Failure [Rants, Raves, and Praise]
· [NFL] Week 9 Games Thread [Sports Chat]
· [WIN7] Which Services in Win 7 Have You Turned Off? [Microsoft Help]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· Windows 7 boot manager editing questions [Microsoft Help]
· NO ONE knows what's wrong with my line! [TekSavvy]
· [Need Info] Looking for backup software... [Software]
· [How to] Install Asterisk on an Asus WL-520GU router [VOIP Tech Chat]