The following is one file index.php GetWidth and GetHeight functions work. (They are not final functions so not important.) The important part is marked by /* IMPORTANT HERE */ What I am trying to accomplish is pass the variable I get using jQuery Window Portal Height / Width and pass it to a PHP script here In other words when I get value from GetWidth() it should go to w=120 or replace 120 value with whatever the width is at the moment and the same with height. If there is any syntax errors please ignore.
I only want to figure out how to pass value from jQuery to PHP scrip. Also in the future I want add on resize method so values will be dynamic when window is resized.
<html>
<head>
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
$(window).resize(function () {
$('#msg').text('Browser (Width : '
+ $(window).width()
+ ' , Height :' + $(window).height() + ' )');
});
$(document).ready(function() {
// DOCUMENT READY
function GetWidth() {
if (self.innerWidth) {
return self.innerWidth;
}
else if (document.documentElement &&
document.documentElement.clientHeight) {
return document.documentElement.clientWidth;
}
else if (document.body) {
return 0;
}
return x;
}
function GetHeight() {
if (self.innerHeight) {
y = self.innerHeight;
}
else if (document.documentElement &&
document.documentElement.clientHeight) {
return
document.documentElement.clientHeight;
}
else if (document.body) {
return 0;
}
return y;
}
// This is for when it first loads.
$('#TEXT').text('W: ' + $(window).width() + ' , H:' + $(window).height() + y);
// This is for when window gets resized.
$(window).resize(function () {
$('#TEXT').text('W: ' + $(window).width() + ' , H:' + $(window).height());
});
// DOCUMENT READY
});
</script>
</head>
<body>
Info Area:<br>
<div id="TEXT"></div>
/* IMPORTANT HERE */
<!-- img src="timthumb.php?src=URL...image.jpg&h=180&w=120" -->
/* IMPORTANT HERE */
</body>
</html>