Note that the usage of variable ‘x’ after $(document).ready(function(){}) should be independent i.e. it should not be used inside some function or callback function.
If it isn’t inside another function, then you will be trying to use it immediately … which is before the ready
event fires … so it will be before the value has been assigned to the variable.
In short: No.