how to make a http request in jsonp callback?

I’m trying a xss challenge. I found an exploit that breaks CSP by using a JSONP callback. I can get an alert to pop up by putting something like

<script src="https://whitelisted.jsonp?callback=alert#1"></script> 

But I’m having trouble trying to get it to send an httprequest.

I’ve tried putting functions changing window.location, but it doesn’t seem to execute any of my anon functions.

Thanks

Separa callback de mi código para reutilizar

Tengo el siguiente código como servicio:

   findById_multiple(ids: string[]): Observable<Proceso[]> {        let a = this._preLoaderService.loading("Buscando procesos por defecto")        let i = { busqueda: ids }        return this.http.post(`$  {this.base}/buscar_multiple`, i).pipe(          map((resp: any,) => {          let p: Proceso[] = []          resp.procesos.forEach((pp) => {            let np = new Proceso().deserialize(pp)            p.push(np)          })          this._msjService.ok_(a)           return p        }),          catchError(this.err)        )      } 

Me gustaría extraer el callback que tengo dentro de mappara reutilizarlo por que este código se repite. El problema es que no encuentro la manera de pasar al callback el parametro a que genero y que despues utilizo en la linea this._msjService.ok_(a).

Hay manera de lograr esto sin que a se aplique a a toda la clase?

Olá galera! estou tentando criar uma API de busca de cnpj para um formulário e fico recebendo erro de callback, alguém pode me ajudar

Esse é o erro que aparece:

Cannot GET /v1/cnpj/04.496.152/0001-88?callback=jQuery222009318744443713212_1564487360565&_=1564487360567

esse é o codigo da API:

$ (document).ready(function(){ $ (“#cnpj”).focusout(function(){ $ .ajax({ type: “GET”, url: “https://www.receitaws.com.br/v1/cnpj/”+$ (“#cnpj”).val(),
dataType: ‘jsonp’, success: function(data) { console.log(data); $ (“#razao_social1”).val(data.nome); //$ (“#fantasia”).val(resposta.fantasia); //$ (“#telefone”).val(resposta.telefone); //$ (“#email1”).val(resposta.email); //$ (“#logradouro”).val(resposta.logradouro); //$ (“#complemento”).val(resposta.complemento); //$ (“#bairro”).val(resposta.bairro); //$ (“#cidade”).val(resposta.municipio); //$ (“#uf”).val(resposta.uf); //$ (“#cep”).val(resposta.cep); //$ (“#numero”).val(resposta.numero); } }); }); });

URL de callback c#

estou fazendo um dll em C# para conectar no RD Station, para autenticar, preciso de um GET uma url ” https://api.rd.services/auth/dialog?client_id={client_id}&redirect_url={redirect_url}” Então se eu coloco redirect_url=https://pt.stackoverflow.com/ Se der tudo certo caso eu autentico, ele me redirecionar +ou- assim: https://pt.stackoverflow.com/code=XXXXXXX O resultado deste get é uma chamada no redirec_url, que vem com um código Tem como eu pegar este Callback URL para capturar este código numa class libary que estou desenvolvendo?

Como guardar o valor do input em função callback

Como posso guardar em uma variável o valor do input na função abaixo ?

showSwalConfirmText(callback) {         const { value: text } = this.swal.question({             title: 'Você tem certeza?',             input: 'textarea',             inputPlaceholder: 'Digite o motivo...',             showCancelButton: true,             confirmButtonColor: '#3085d6',             cancelButtonColor: '#d33',             confirmButtonText: 'Sim',             cancelButtonText: 'Não',             confirmButtonClass: 'btn btn-success',             cancelButtonClass: 'btn btn-danger',             buttonsStyling: true,                      }).then(function () {             callback(true);         }, function (dismiss) {             if (dismiss === 'cancel') {                 callback(false);             }         });     }

Triggering a callback when user put in the Konami cheat code anywhere in the page

I wrote this just for some fun and also to practise my ES6 skills. When user key in the Konami Cheat Code(⬆️⬆️⬇️⬇️⬅️➡️⬅️➡️🅱️🅰️↩️) anywhere in the page, it should trigger a callback. In the following example, it should trigger an alert.

What could be improved?

Are there more ES6 features I could use in this code?

const {onKonamiSequenceTriggered, clearKonamiSequanceTriggered} = (() => {     const konamiSequence = ["ARROWUP", "ARROWUP", "ARROWDOWN", "ARROWDOWN", "ARROWLEFT", "ARROWRIGHT", "ARROWLEFT", "ARROWRIGHT", "B", "A", "ENTER"];     konamiSequence.reverse();     let currentSequence = Array.prototype.slice.call(konamiSequence);      const callbacks = {};      let eventId = 0;      const onKonamiSequenceTriggered = callback => {         callbacks[eventId] = callback;         return eventId++;     };      const clearKonamiSequanceTriggered = id => delete callbacks[id];      document.addEventListener("keyup", event => {         if (event.key.toUpperCase() !== currentSequence.pop()) {             currentSequence = Array.prototype.slice.call(konamiSequence);         }         if (!currentSequence.length) {             Object.values(callbacks).forEach(callback => {                 try {                     callback();                 } catch (e) {                     console.error(e);                 }             });             currentSequence = Array.prototype.slice.call(konamiSequence);         }     });      return {         onKonamiSequenceTriggered,         clearKonamiSequanceTriggered     }; })();  onKonamiSequenceTriggered(() => alert("You've got it!")); 

How to transform a quote into an order from CALLBACK HOOKS, MAGENTO 2.3

I’m trying to integrate a payment gateway. And they provide a callback hooks i’ve set for them to return me the CartID (Quote’s entity_id).

But from here on, it feels like it isnt right for me to call guest API, as the cart belongs to an actual customer’s cart. Neither do i have the access tokens when the callback hook is being sent to the API i’ve created.

How can i create the order (sales_order table & sales_order_grid) based on the quote i could receive ?

Please advise what should i do as im stuck on this for 3 days.

can’t access ‘this’ function in React callback

I have a React component where by I need to change the state after a successful database call. The database call uses a callback function, which I can’t change, however I can’t find a way to access the redirect function in the same component, from within the call back function. I just get the error enableRedirect' of null

I’ve tried changing the callback function to an arrow function, but then it doesn’t get called correctly. I’ve been reading other answers to similar problems, but can’t make it apply to my situation

    ...     componentDidUpdate = (prevProps, prevState) => {     if (prevState.braintreeToken !== this.state.braintreeToken) {        dropin.create(         {           authorization: this.state.braintreeToken,           container: "#dropin-container",         }, //callback function happens here         (createErr, instance) => {           button.addEventListener("click", function() {             instance.requestPaymentMethod(function(               requestPaymentMethodErr,               payload             ) {               api                 .submitPayload(payload, plan, id)                 .then(res => {                   //this is where I'm trying to call my enable redirect function                   this.enableRedirect();                 })                 .catch(err => {                   //error handling                 });             });           });         }       );     }   };      // the function I'm trying to call     enableRedirect = () => {       this.setState({         redirect: true       });     };  ... 

I need the enableRedirect Function to be called in the callback!

How to solve “@deprecated — Use an observer instead of a complete callback”?

So I was trying to get data by using http call and after I use my code, It won’t work and when I check, it does not produce any array. It gave me this message after I hover my mouse over the subscribe function.

Here are my code:

public getCust(){ this.http.get(this.thisUrl+’name=’+this.param.namaID+’&dob=’+this.param.dob+’&idno=’+this.param.idno+’&idt=’+this.param.idt+’&norek=’+this.param.norek+’&cif=’+this.param.cif) .subscribe((res : any[])=>{ console.log(res); this.custs = res; }) }

These are the message that produce by me hovering over the subscribe function:

(method) Observable.subscribe(next?: (value: Object) => void, error?: (error: any) => void, complete?: () => void): Subscription (+4 overloads) @deprecated — Use an observer instead of a complete callback

@deprecated — Use an observer instead of an error callback

@deprecated — Use an observer instead of a complete callback