Solved

Jquery autocomplete return data from script

Posted on 2013-11-19
3
376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
 
LVL 1

Author Closing Comment

by:nachtmsk
ID: 39660127
Thanks that worked!
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
This article discusses how to create an extensible mechanism for linked drop downs.
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)

624 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