How would one, in Javascript, activate a function when an XHR request is fired from a specific request URL?

How would one, in Javascript, activate a function when an XHR request is fired from a specific request URL?

Attached: lmaoxD.png (666x771, 424K)

Other urls found in this thread:

npmjs.com/package/q
twitter.com/SFWRedditGifs

Too vague

by googling it

>IQ scores drop
I'm sure it has nothing to do with "the changing face of america", which is good thing.

>hip hop rapfaggot culture is more prevalent among young people than ever before
>IQ drops across the board
Color me surprised.

Usually you would do something with routing and your back end framework would help you out.

If you're talking about how to get the url of a window, you could just use window.location

You could also make a post request with this information, and just send the client's current url.

What are you trying to achieve? Can you post the code you already have?

you could override XMLHttpRequest.prototype.open with a wrapper function / Proxy object to check the target url and call your callback if thats what you were asking

I don't think posting the code would help that much, but here's the gist of it

essentially, only when an XHR request is fired and returned succesfully does a certain BUTTON appear on the page.

I am using a function, loadBanner(); say, to target this button and insert something before it

the problem is, this button only appears when a certain other button is clicked - and I've tried the onclick thing + a delay to give the XHR request time to go, but it didnt work

so I need to add something like an event listener to the whole document I think, that will listen for an XHR event happening and then activate loadBanner();

hope this makes sense

OP here, is there any way actually to continuously scan for a certain named element being there, lets say for example "porn",

Like there's a scan every second or so to check if this DOM is present or not?

Look into Promise and use MDN as your reference and guide, don't use W3Schools

There's also the Q package
npmjs.com/package/q

Attached: 1508414551329.jpg (900x900, 108K)

const fuckid = setInterval(() => {
const el = document.getElementById("porn");
if (el) {
clearInterval(fuckid);
// do shit with el
}
}, 100);

It has to do with plugging babies into iPads to calm them down since they're small. Replacing games and real-world exploration with passive content consumption reduces the development of the brain.
>"muh le nigers have a le low iq" maymay
Poor people in general have a lower IQ than middle and upper class people. A poor diet, high streess levels, violent environments and depression during their upbringing reduces IQ scores.

>In other news, immigration from shit hole countries is soaring to new heights.

Great and informative post

Get away from here Jow Forums, the image clearly says electric devices are the cause

Via which they browse /mu/ and other hip hop dumps that fry their brains with fagrap.

>Immigrants don't use electronic devices

>Poor people in general have a lower IQ than middle and upper class people.
Poor white people have higher IQs than middle class black people, don't be delusional.

Their upbringing is what matters.

>Tristan Harris, a “design ethicist” (whatever that is) tells the author that it’s not a question of willpower when “there are a thousand people on the other side of the screen whose job it is to break down the self-regulation you have”. After all, Steve Jobs gave the world the iPad, but made very sure his kids never got near one. Brain patterns of heroin users just after a hit and World of Warcraft addicts starting up a new game are nearly identical. The tech innovators behind our favourite products and apps understood that they were offering us endless portals to addiction. We’re the only ones late to the party.
>Addiction isn’t inherent or genetic incertain people, as was previously thought. Rather, it is largely a function of environment and circumstance. Everyone is vulnerable; we’re all just a product or substance away from an uncomfortable attachment of some kind. And the internet, Alter writes, with its unpredictable but continuous loop of positive feedback, simulation of connectivity and culture of comparison, is “ripe for abuse”.
>Though the age of mobile tech has only just begun, Alter believes that signs point to a crisis. In 2000, Microsoft Canada found that our average attention span was 12 seconds long. By 2013, it was eight seconds long. Goldfish, by comparison, can go nine seconds. Our ability to empathise, a slow-burning skill that requires immediate feedback on how our actions affect others, suffers the more we disconnect from real-life interaction in favour of virtual interfacing. Recent studies found that this decline in compassion was more pronounced among young girls. One in three teenage girls say their peers are cruel online (only one in 11 boys agree).

Completely agree with the first part, but you're just out of your mind if you think race has nothing to do with intelligence. I didn't say niggers were the sole reason, my point was more that these columnists will write articles about both phenomena but would never mention them together, even though it's a very obvious thing to look at.

t. never lived around shitskins

You would hook into the “Dumbfuck clicks a link that would normally move them to another page” listener
// Phseudocode because I'm lazy
when (a.href clicked):
stop()
const newbody = await xhr.get(uri)
document.body = newbody

Yes, because the nog who is the author is going to come to the conclusion it's biological. Dumbass.