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

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -