Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

202
Vistas
How can I pass window.screen to the back-end via AJAX?

If I do : window.screen, I got :

Screen {availWidth: 3440, availHeight: 1415, width: 3440, height: 1440, colorDepth: 24, …}availHeight: 1415availLeft: -1057availTop: -1415availWidth: 3440colorDepth: 24height: 1440orientation: ScreenOrientation {angle: 0, type: 'landscape-primary', onchange: null}angle: 0onchange: nulltype: "landscape-primary"[[Prototype]]: ScreenOrientationpixelDepth: 24width: 3440[[Prototype]]: Screen

So I assume, I can access it, so I sent it to my back-end like this so :

var data  = {};
data.w = window.screen; //as soon as I did this, I can't never see request sent out in the network tab, if I changed that line to `data.w = 'test';`, only then I see request sending out again... 


$.ajax({
    method: 'POST',
    url: '/tested-route',
    crossDomain: true,
    contentType: false,
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
        "Accept": "application/json",
        "Content-Type": "application/x-www-form-urlencoded",
        "Cache-Control": "no-cache"
    },
    data: data,
    success: function(response){
        console.log(response);
    },
    error: function(jqXHR, textStatus, errorThrown) {
        console.log(JSON.stringify(jqXHR));
        console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
    }
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Only enumerable properties of an object will be serialized by JSON.stringify.

Copy the properties you care about to a new object and encode that if you want to encode them as JSON.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda