Portal Home > Knowledgebase > Articles Database > pass jQuery value to PHP script
pass jQuery value to PHP script
Posted by borg77, 09-12-2010, 12:57 AM |
I'm trying to get visitor screen resolution.
jQuery
...
var browserWidth = $(window).width();
var browserHeight = $(window).height();
$.post("submit.php", { width: browserWidth, height: browserHeight } );
...
PHP submit.php
...
$width = $_POST['width'];
$height = $_POST['height'];
...
In firebug the following error is shown:
POST http://domain/submit.php 500 Internal Server Error
Any tips/help will be much appreciated.
|
Posted by webbanner, 09-12-2010, 07:02 AM |
seems like problem is with your php file, maybe syntax error somewhere on the php file?
|
Posted by DiabolicG, 09-12-2010, 07:16 AM |
You can submit whole php script?
|
Posted by bobbravo2, 09-15-2010, 10:45 PM |
Definitely a syntax error with your php. Have you console.log(height) to make sure that jQuery is parsing a value?
|
Posted by borg77, 09-15-2010, 10:46 PM |
Thanks for your replays I found a solution.
|
Add to Favourites Print this Article
Also Read