Solved

Jquery autocomplete return data from script

Posted on 2013-11-19
3
367 Views
Last Modified: 2013-11-19
Hi,
I'm trying to use the auto-complete function in Jquery to by returning data from a perl script.
I started with an example from the jquery site (see below). The example works fine when I use the local availabletags array, but when I try to call the script 'getnames.pl', nothing happens. I put a log file into the script and I can see the script is never called.

If I run the script manually it works fine.

I think the issue is that the script isn't be called/executed properly.
I am running Windows 2008. I have execute permissions set correctly on the directory that script resides in. I know this because I've tested other scripts in that directory using ajax calls.

I'm thinking the issue is someplace around here:
$( "#tags" ).autocomplete({
source: "C:\inetpub\wwwroot\f\getnames.pl"
});

Open in new window


Please help.
Thanks!
Nacht


---------------------------
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: "C:\inetpub\wwwroot\f\getnames.pl"
});
});
</script>
</head>
<body>
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags" />
</div>
</body>
</html>

Open in new window

-----------------------
0
Comment
Question by:nachtmsk
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39659955
use an http or https source, not a pth to your file
your page MUST be on the same http(s) server
0
 
LVL 32

Expert Comment

by:Big Monty
ID: 39659977
you may also want to specify the data type as JSON in your ajax call:

$( "#tags" ).autocomplete({
source: url,
dataType: "json"
});
0
 

Author Closing Comment

by:nachtmsk
ID: 39660127
Thanks that worked!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now