baconjs / bacon.js

Functional reactive programming library for TypeScript and JavaScript

Home Page:https://baconjs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

J Query Cannot read property 'label' of undefined

susritha22 opened this issue · comments

var arr=['1700000','1700001','1700002'];
var suggest = function(request, response) {
$.ajax({
type: "POST",
url: suggestUri,
dataType: "json",
headers: {
"api-key": "{{ searchServiceApiKey }}",
"Content-Type": "application/json"
},
data: JSON.stringify({
top: {{ searchResultsPerPage }},
select: "articlepublicnumber,Id,title,new_brandmultiselectstring",
filter: "(statuscode eq 7 and statecode eq 3)",
suggesterName: "{{ searchSuggestorName }}",
search: request.term,
highlightPreTag: highlightPreTag,
highlightPostTag: highlightPostTag
}),
open: function(event, ui) {
$(".ui-autocomplete").hide();
},
success: function(data) {
if (data.value && data.value.length > 0) {
response(data.value.map(function (x) {
$.each(arr, function (index, value) {
if(x["@search.text"].indexOf("KA") >= 0 && x.new_brandmultiselectstring.indexOf(value)>=0){
return '<a class="underline" title="' + x["articlepublicnumber"] + ' - ' + x["title"] +
'" href="/knowledgebase/article/' + x["articlepublicnumber"] + '/en-us?highlight=' + x["title"] + '" >'
+ x["articlepublicnumber"] + ' - ' + x["title"] + '';

                                    }else if(x.new_brandmultiselectstring.indexOf(value)>=0){
                                        return x["@search.text"];
                                    }
                              });
                        }));
                     }
                 }
             });
         };

I got the data and it went inside success function of jQuery.
Getting the below error:
jquery-ui.js?=1591636436303:6075 Uncaught TypeError: Cannot read property 'label' of undefined
at $...normalize (jquery-ui.js?=1591636436303:6075)
at $...normalize (jquery-ui.js?=1591636436303:144)
at $...__response (jquery-ui.js?
=1591636436303:6035)
at $...__response (jquery-ui.js?=1591636436303:144)
at $...superApply (jquery-ui.js?=1591636436303:133)
at $...__response (jquery-ui.js?
=1591636436303:6225)
at $...__response (jquery-ui.js?=1591636436303:144)
at $... (jquery-ui.js?
=1591636436303:6023)
at proxy (jquery-1.12.4.js:529)
at Object.success ((index):584)

How is this related to Bacon.js?

Oops wrongly submitted.sorry