jquery - PHP json_encode behaves differently in different php version -
my code in php , jquery
<script type="text/javascript"> $(function() { var city_list = <?php echo json_encode($_request['cities']); ?> alert("city_list:: "+city_list); });
this working fine in local php version 5.3.1, when put server php version 4.3.11 not working...
i need work on both local , sever side.
here file can use php < 5.2.
http://www.boutell.com/scripts/jsonwrapper.html
and can compare versions this:
if (version_compare(php_version, '5.2.0', '<')) { //include or require jsonwrapper file }
Comments
Post a Comment