Hi @Juanse,
from what I see the problem relies in the line:
var articles_for_searching = {{articles_for_search|json}};
What happens if you just console log after that line?
I usually use a webteamplate on another page to fetch the XML and refer to that page from whereever I want to use the JSON data.
You can reference the text from the website containing only JSON and use JSON.parse() to afterwards further manipulate it.
{% fetchxml YourEntity %}
<fetch>
<entity name="YourEntityName">
<attribute name="Attr1" />
<attribute name="Attr2" />
</entity>
</fetch>
{% endfetchxml %}
<!-- Creating a JSON Element -->
[
{% for item in YourEntity.results.entities %}
{
"id": "{{ item.id }}",
"name": "{{ item.name }}"
}{% unless forloop.last %}, {% endunless %}
{% endfor %}
]
WarrenBelz
9
Most Valuable Professional
Rondel
6
oliver.rodrigues
4
Most Valuable Professional