0

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.

asked Nov 1, 2013 at 21:42
4
  • Where is the file located? Commented Nov 1, 2013 at 21:43
  • the file is located on my local computer. will be in the same directory has my html file Commented 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 ? Commented 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? Commented Nov 1, 2013 at 21:58

1 Answer 1

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.

answered Nov 1, 2013 at 22:21
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.