Solved

jquery autocomplete function

Posted on 2014-04-11
1
428 Views
Last Modified: 2014-04-11
Hi,
I have the autocomplete function working properly, in that I can send in my terms and return my JSON (to perl).
Here is the JSON I am getting back from my database query via the autocomplete field:
[{"empid":"A9DDDB08-DBF4-4BC0-9F07-E48F08221FBA","value":"David Smith"}]

Here is the jquery/HTML on my page
-----------
$(function() {

$( "#tags" ).autocomplete({
source: "../f/getnames2.pl",
minLength: 2,
dataType: "JSON"
});
});
</script>
</head>
<body>
<div class="ui-widget">
<label for="tags">Name: </label>
<input id="tags" />

Open in new window

------------------


My question is this. How can I get the value of empid from my json to be associated with the value that is returned from auto-complete?
I  need to use the value of empid in another database query so I need to return it when the form is submitted.
I don't really know jquery, I've been trying various things but nothing is working.

Thanks!
Nacht
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
1 Comment
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 500 total points
ID: 39994975
$( "#tags" ).autocomplete({
  select: function( event, ui ) {
    alert(ui.item.empid);
  }
});

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

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.
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
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 how to dynamically set the form action using jQuery.

752 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