bob sandes
bob sandes

Reputation: 1

Reading from a file jQuery

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.

Upvotes: 0

Views: 44

Answers (1)

Captain John
Captain John

Reputation: 1891

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.

Upvotes: 1

Related Questions