Jump to content

Recommended Posts

I have only the haziest understanding of AJAX, but at this point I just want to check the height of the browser window and get that into a PHP variable before I generate the actual page. Is there an example of that sort of thing posted somewhere? I'm working in Joomla, so jQuery is loaded.

 

Thanks,

Drew

if your using jquery 
 

$(window).height();   // returns height of browser viewport
$(document).height(); // returns height of HTML document
$(window).width();   // returns width of browser viewport
$(document).width(); // returns width of HTML document

i admit to knowing practically nothing about AJAX, but these look to me like they would be functions that could be used in javascript -- in the browser, of course. How would I then get these values back to PHP variables on the server? 

If you know nothing about Ajax, how about learning it? jQuery has an excellent documentation. And of course there's Google with tons of additional explanations.

 

I don't see the point of repeating the same things that have already been written down thousands of times and are just waiting for you to read them.

Well sure, and having a quick example performing a very simple comparable action would help get me up to speed in a hurry. Could you point me toward a minimal document that would do something like retrieving a screen dimension before generating the actual page? Or I could Google for hours in hopes of finding something like that.

Edited by Drew_Tronvig

there should be a lot on stackflow. when I was looking for a way to center a div, it took me a few minutes to find it.

 

how much time it takes depends on what you search for. try http://stackoverflow.com/questions/2407221/how-to-get-the-height-of-the-screen-using-jquery (took 30 seconds to find btw)

Yeah, I gave up trying to Google up an answer and asked the question at stackoverflow. I got a promising answer, and now I'm just trying to stitch together the parts from that answer into an actual working example.

 

I certainly appreciate the help here, but I was already pretty clear on how to get the values in via jquery. The trick is how to get those values back to the PHP script on the server, hence asking on the AJAX board.

 

Thanks,

Drew

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.