Solved

Jquery autocomplete return data from script

Posted on 2013-11-19
3
370 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 33

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn how to dynamically set the form action using jQuery.
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)

776 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