我有以下
var storage = [], obj;
$('form input[type=hidden]').each(function(){
obj = {};
obj[this.name] = this.value;
obj["spot"] = this.className
storage.push(obj);
});
storage = $.toJSON(storage);
console.log(storage);
$.post('storage/', storage, function(data) {
if(data == "true") {
//window.location.href = href;
}else{
alert("An error has been encountered, Blah has been notified, please try again later");
}
});
和PHP我有一个简单<?php print_r($_POST); ?>
,它是印刷Array()
它似乎并没有被张贴JSON编码的结果。
这使我疯狂,我不知道发生了什么事大声笑。任何帮助?
ps。我使用http://code.google.com/p/jquery-json/作为json编码器。
你从'console.log()'中得到了什么? – Treffynnon 2012-01-30 19:39:44