/    Sign up×
Community /Pin to ProfileBookmark

can ny 1 tell me how can i use a database on the client side???
this is what i want to do
the database will reside in the document root of the web server(apache in my case) and i want to access that from my javascript code(which resides on the client side)…
i want the same functionality like i query a database server(mysql in my case) from a server side language(PHP in my case) and then return it to the client….
except that i dont want to load my PHP interpreter uselessly

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@TJ111Jan 29.2008 — You will have to use some server side script (like PHP) to handle the database functionality. Javascript exists solely on the client and doesn't have access to the server (except through some server side scripting, whether it be PHP or Perl, whatever). There is a JSON-style database somewhere I read about once that I believe you can query directly from javascript, although that'd require a whole new database.
Copy linkTweet thisAlerts:
@karnthi117authorJan 30.2008 — srry but u mistook me i want to access a file that is written in a csv or html format(i read somewhere that it is possible). and the file acts as a database
Copy linkTweet thisAlerts:
@cgishackJan 30.2008 — not possible on the web.

JavaScript can not access files.

There are ways (mainly by Microsoft) but only when running on a local computer, not on the web.
Copy linkTweet thisAlerts:
@cgishackJan 30.2008 — well. actually you could use ajax to get a csv...

Check out this guys lib.. its sweet..

http://www.kawa.net/works/js/jkl/parsexml-e.html [see JKL.ParseXML.CSV - for CSV file as array of array ]

Drew
Copy linkTweet thisAlerts:
@karnthi117authorJan 30.2008 — well i think javascrpit will b able to access any files in the document root of a web server.

plz tell me a way in which i can use ajax to get a csv
Copy linkTweet thisAlerts:
@JMRKERJan 30.2008 — See if post #5 of: http://www.webdeveloper.com/forum/showthread.php?t=171311

can be of some help. It reads a text file, but a csv is just a variation of that.

Some other examples are located in post #10 of same thread.
Copy linkTweet thisAlerts:
@KorJan 30.2008 — if the domains are different (the DB file and the web document), the only way is to use a server-side application, written in php your case, which will send a request to the other domain (if that server allows that). Now, depending on what you want (to change or not the session while that request is made) you may use AJAX to send that request, but to [I]the same domain[/I] php server-side aplication, which will pass the request to the third part.

For instance I have developed an AJAX/php application which grabs some Meteo data from a third part web page (with their agreement, of course) and writes them on my client's page on load and change them only from time to time within the same session (based on some cookies). Is that kind of issue what you have in mind?
×

Success!

Help @karnthi117 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...