Skip to content

Commit

Permalink
Clean up for jsonp usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Kolstad committed Mar 30, 2012
1 parent a0bd909 commit 2032a5f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.html
Expand Up @@ -14,17 +14,18 @@
source: function (request, response) { source: function (request, response) {
var userTerm = request.term; var userTerm = request.term;
$.ajax({ $.ajax({
url: "http://dev.finn.no/finn/job/autocomplete/frontpage/xhr", url: "http://iad.finn.no:8080/finn/job/autocomplete/frontpage/jsonp",
data: { data: {
rows: 5, rows: 5,
term: userTerm term: userTerm
}, },
jsonp: "jsonp",
dataType: "jsonp", dataType: "jsonp",
success: function (data) { success: function (data) {
response($.map(data, function (item) { response($.map(data.result, function (item) {
var ad = item.hits !== 1 ? "annonser" : "annonse"; var ad = item.hits !== 1 ? "annonser" : "annonse";
return { return {
label: highLight(item.suggest, userTerm) + " <span class='pale fright'>(" + item.hits + " " + ad + ")</span>", label: item.suggest + " <span class='pale fright'>(" + item.hits + " " + ad + ")</span>",
value: item.suggest, value: item.suggest,
hits: item.hits hits: item.hits
}; };
Expand Down

0 comments on commit 2032a5f

Please sign in to comment.