Heads up! This post was written 13 years ago. Some information might be outdated or may have changed since then.
За една от задачите си се наложи да "пакетирам" javascript обект и да го изпратя чрез $.post. За целта превръщаме js обекта в json масив чрез https://raw.github.com/douglascrockford/JSON-js/master/json2.js
json = JSON.stringify(js_object);
$.post('http://demo.bg/test.php', {'params': json}, function(){});
а в php
$r = $_POST['params'];
$r = json_decode($r);

Back to all posts