XF 2.1 Calling JS in for node

Exotic_Peacock

New member
Hey all,
I am so sorry to be back with yet another question I am trying to learn how to do a lot of this myself rather than relying on addons etc.
Okay so on my site I am trying to have the 'Rona stats for Australia. I was given this .js code:

Code:
var settings = {
  "url": "https://corona.lmao.ninja/v2/all",
  "method": "GET",
  "timeout": 0,
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

I only want it to appear in forumid 29, under the title and description.

I have been trying for about 2 hours and getting no where, I don't know if it's obvious and I am tired but can someone please help me with the code and directions to get this to appear please!
 
I recommend to use the advertising system for this. You don't need to edit templates for this possible temporary issue.

Create a new Advertisement and choose probably Forum View: Abov thread List as the position.

Then insert this Code:

HTML:
<xf:if is="$forum.node_id==29">
<xf:js>
var settings = {
  "url": "https://corona.lmao.ninja/v2/all",
  "method": "GET",
  "timeout": 0,
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
</xf:js>
</xf:if>

Fill out title, and hit save.
 
Hey @Hoffi,
Really appreciate the assistance however I place:
Code:
<xf:if is="$forum.node_id==29">
<xf:js>
var settings = {
  "url": "https://corona.lmao.ninja/v2/all",
  "method": "GET",
  "timeout": 0,
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
</xf:js>
</xf:if>
I'm still looking through the system to track down stats for Australia :)
But I place it in the advertising system.

But then when I head to the node in my site here! Nothing at all shows up. It's as if though I never existed lol!

Am I doing something wrong? Haha I for the life of me cannot figure this out haha.
 
OMG I am so embarrassed and want to face palm myself so hard words cannot describe. This person right here was putting it in the wrong advertising position.

Many thanks for your help and trust me my face is redder than a perfectly ripe tomato. Thank you once again for your help.
 
Back
Top Bottom