Revision: 62659
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 5, 2013 18:37 by dosde
Initial Code
$array //has our data //in the tools file array_walk ($array, 'utf8_encode_array'); //could lead to UTF-8 problems.. echo json_encode($array); function utf8_encode_array (&$array, $key) { //encodes the array recursively to utf8 if(is_array($array)) { array_walk ($array, 'utf8_encode_array'); } else { $array = utf8_encode($array); } } /*********************************************/ //Ajax request to the tools file: ?> <script type="text/javascript"> $.ajax({ type: "POST", url: '<?php echo Loader::helper('concrete/urls')->getToolsURL('path_to_tools_file.php', 'packagename_or_empty'); ?>', data: data, //send data as POST (data is an object) success: function(msg) { try { var myObj = jQuery.parseJSON(msg); myObj.images; myObj.name; myObj.text[0 .. n]; }catch(e){ alert(e.error); } } }); </script>
Initial URL
Initial Description
Send array through ajax tools request to js
Initial Title
Send array through ajax tools request to js
Initial Tags
ajax
Initial Language
PHP