I am new to web programming and Jquery. I was looking to do something that seems fairly simple and basic but I am unsure of how to really accomplish this task. This is for a project of my own that I am doing just for leisure time. What I am attempting to do is read from a file that is in the same directory if a value entered by the user exists or not. Here is what I mean. Here is a sample html of what I am talking about.
<html>
<head>
<title> Test </title>
<body>
<input type = "text" id = "testText" name = "testText" value = "Enter some text" />
</body>
</html>
Based off of this, what I am trying to do is when the user types in some text, I want to be able to check if the value that the user enters in exists in a text file. Not sure if Jquery is the easiest way, but I would like to learn Jquery, that is why I am trying this.
-
Where is the file located?Jason P– Jason P2013年11月01日 21:43:47 +00:00Commented Nov 1, 2013 at 21:43
-
the file is located on my local computer. will be in the same directory has my html filebob sandes– bob sandes2013年11月01日 21:45:41 +00:00Commented Nov 1, 2013 at 21:45
-
And is your local computer running a web server, or are you doing this with a file protocol and not a http protocol ?adeneo– adeneo2013年11月01日 21:51:26 +00:00Commented Nov 1, 2013 at 21:51
-
No, I do not have a web server. I believe for now I will be using a file protocol. File protocol as an example is like this?: File://C/documents..... something like that correct?bob sandes– bob sandes2013年11月01日 21:58:13 +00:00Commented Nov 1, 2013 at 21:58
1 Answer 1
A web browser does not have direct access to the client computers file system through javascript. This would be a massive security hole, so there is no way you can actually access the client computers file system in code.
However if you want to load a text file off a server you could try and learn ajax, which is pretty fundamental.
http://api.jquery.com/jQuery.ajax/
Loads the text file into the Browser using ajax.