In fact he encodes twice..

 
Pauk: Renlo I can’t even get an anonymous function to work :

Dilcher: Window.addEventListener’message’, function e { console.loge.data }; . then in the oauth callback or I’d think I could also just do it in the console of the popup window window.postMessage”foo”, window.location.origin;

Anstey: What is generating the ‘message’ event

Sessom: The opened window i guess

Bemrich: Are they even sending that message?

Matsuki: Ya. one thing to note is the flow goes. window.open popup – twitter.com redirect – myorigin.com/twitter/callback window.postMesssage

Terrero: My guess is that it’s erroring out before the event listener is added

Gerdiman: If you do window.addEventListener’message’, functiond { console.log’foo’,d; }

Mejorado: Should I be able to do window.open and then do window.postMessage within the console of the popup?

Koy: I would think so, I am not sure though

Surdam: This makes no sense :

Fleegle: Start small, eliminate all possible causes of the issue, then you will arrive at the cause

Ratzloff: Right now there are like 5 big reasons why it might be failing

Haught: PostMessage weirdness, weirdness with bind, weirdness with twitter, etc. etc.

Thomley: Also, I would set the second param of post message to ‘*’

Jotblad: Https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#Syntax , look at targetOrigin

Muddiman: It could be that your targetOrigin is incorrect

Jeffress: I don’t have any motivation today. I needz motivation!

Kilkenny: Renlo ya I took out twitter, took out bind, and tried a few targetorigin possibilities :

Levinthal: Window.postMessage actually works from within the same window

Krawiec: So we now the eventlistener is working

Forbish: Tried putting the message in a setTimeout . wtffuuuuu

Shinaberry: Hm, i got an idea, i could use google ****ytics as a database

Lastinger: Well i give up for now

Manatt: Reduce the number of possibilities

Flory: Is this a good methode to call a JS function out of a PHP Script? https://gist.github.com/anonymous/cdeae8c3606aa443a439/5b37cd688fbc089f8b5b81286ff284b5d40b3720

Sowle: Kalio_, no. write an API

Steinharter: If the project is complex enough and requires care, write an API and retrieve the data by a POST/GET request

Branscum: Just a simple Rest API

Recidivi: But if it’s just a simple. one case situation

Colborn: Felishia: I only have one request from DB to CLient

Bentler: If it’s just a one time case. then it can be ok

Iwanyszyn: And if you’re ok sticking to PHP

Detienne: If you’re in a more profesional environment where you need javascript to retrieve data you should write an API.

Palenik: Felishia: When a User refresh the page, the request will run one time

Wierzbicki: I’m talking about the whole website

Aguillera: Someone help me, I’m dumb at explaining DX

Maez: Felishia: Oh okay no this is a simple one

Wachowiak: Then it’s ok, don’t overdo if things are simple

Radilla: Felishia: Okay but with my script I’ve posted, i got an undefined back. Why? :PO

Scharpf: But for example if there’s a lot of stuff and a lot of people working on that site, then you should write an API. and retrieving the data as JSON

Keal: Kalio_: its probably still json

Broadnay: Plus. the output has to be encoded

Tarnoff: Var ary = JSON.p**** ?. .?

Deininger: Ary1 will be the second char of the json string

Edmonson: Ary1 will be undefined

Bernabo: Oh **** i saw it i did the encoding twice

Reth: In fact he encodes twice. but expects an object