Question

I'm using a jQuery Easyui datebox and use the value as queryparam in an url.

var date = $('#dd').datebox('getValue');
window.open('file.php?date='.date);

I leave the datebox empty and fire the code. When I check file.php in IE 8.0 I get $_GET['date']='1970-01-01' but in Chrome v32.0 it is $_GET['date']='0';

Can anyone explain why and give a hint so I can send the same value with the url?

Was it helpful?

Solution

you could add this to make sure to send the same value:

var date = $('#dd').datebox('getValue');
if(date == 0 || date == '0' || date == '1970-01-01' || !date)
date = 0; //or '1970-01-01' if you prefer that one.
window.open('file.php?date='.date);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top