Solved

HTML Special characters not working with JQuery autocomplete

Posted on 2015-01-26
2
772 Views
Last Modified: 2015-01-29
Hi I am having trouble displaying HTML special characters in JQuery autocomplete. for example & appears as & and I want it to appear as &

Here is my code (I am looking for a Javascript or JQuery solution):

<script type="text/javascript">
	
	$(function() {
       
		$( ".auto" ).autocomplete({
		  source: function( request, response ) {
			$.ajax({
			  url: "./auto_search.php?type="+$( ".auto" ).attr("rel"),
			  dataType: "jsonp",
			  data: {
				q: request.term
			  },
			  success: function( data ) {
				response( data );
			  }
			});
		  },
		  minLength: 3,
		  open: function() {
			$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
		  },
		  close: function() {
			$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
		  }
		});
	  });
</script>

Open in new window

0
Comment
Question by:jwleys
[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
2 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 40571453
Hi,
either you use this mentioned extension:
https://github.com/scottgonzalez/jquery-ui-extensions/blob/master/src/autocomplete/jquery.ui.autocomplete.html.js
(mentioned on the official jQuery UI API doc)
or some overides like this:
http://jsfiddle.net/55hu9yx7/

This will HTML decode the values.

HTH
Rainer
0
 

Author Closing Comment

by:jwleys
ID: 40578478
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sort Multi-dimensional array 6 41
CSS Formatting Getting Stripped 1 31
isNaN issue on the Table input text 2 38
How do I refresh ajax data from controller using angular? 3 17
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

738 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