?
Solved

HTML Special characters not working with JQuery autocomplete

Posted on 2015-01-26
2
Medium Priority
?
864 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 2000 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

Industry Leaders: 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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
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

800 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