View Full Version : passing screen resolution to php

02-04-2015, 04:28 PM
im not familiar with JavaScript and Ajax
simply i want to get the user screen resolution then make it as variable in php in the same page without refresh, i tried (document.write) and (Get) but it have problem with the pagination in the main script because it uses the url bar, also i tried to store by cookies, it also have problem that i must refresh the page to execute the code. below is the details:

im using wordpress custom index, what i need is get the user screen resolution to calculate how many posts per page will appear to him

this code is just example because i dont know how to really make it...

//php index.php
var x = screen.width;
var y = screen.height;
// send this variables to server_side
$width=(x); // this method might be ($_Post) coming from auto submitted form or even from database
// -------rest of the code

i need to do this not through ($_Get) from the url and without refreshing
i have been searching week ago without finding any solution because i cant understand java or ajax
please help
thanks in advance
and sorry for bad English