Forum Discussion
Hi Gursimrat
could you please post the code in your <#recover> section?
What I don't understand is where you are trying to access the results variable since I cannot see any such variable in your code and I think that's where the issue is happening.
Thanks,
Nico
Hi NicoB
results are basically the JSONP response I am trying to read. And adding the code to recover didn't help.
{"count":1,"results":[{"result_type":"article","position":0,"comments_disabled":false,"label_names":[],"vote_sum":0,"locale":"en-us","section_id":200164994,"url":"https://community-name.zendesk.com/hc/api/v2/articles/200820164-What-are-these-sections-and-articles-doing-here-.json","id":200820164,"html_url":"https://community.zendesk.com/hc/en-us/articles/200820164-What-are-these-sections-and-articles-doing-here-","draft":false,"source_locale":"en-us","title":"What are these sections and articles doing here?","updated_at":"2014-02-07T23:46:17Z","promoted":false,"name":"What are these sections and articles doing here?","created_at":"2014-02-07T23:46:17Z","translation_ids":[201089774],"author_id":243252074,"vote_count":0}],"previous_page":null,"facets":null,"next_page":null}
Workflow is as below:
From a text box in the custom component, when a user enters a query, and on the click of the search button, the parameter will be passed on to the endpoint. The endpoint will then call the external zendesk API via http request and the returned results will be served to custom component which will display them on the forums.
- NicoB11 years agoLithium Alumni (Retired)
It might not be the cause but I noticed that while in the endpoint you're looking for a "query" parameter:
<#assign search_query = http.request.parameters.name.get("query", "")>
in your JavaScript code it seems like you're passing a parameter with name "search_query":
$.get( "${kb_endpoint_url}", { search_query : queryValue } )/
- Gursimrat11 years agoLeaderThis was not the case @NicoB, I have already tried these out. I only have a requirement where I can pass the value from my custom component text box to this endpoint and get the results back, any other ways?