在使用一个API的时候,文档里写的返回值类型是json,可是试了下返回的明明是xml,还小小的鄙视了一把. 可是解析xml,好麻烦的.最好是json可以直接decode . 意外看到文档下面有一句 JSON response can be obtained by including the following headers in the request 'response-json' =true 就是讲要在post的Header里加上这么一个参数于是返回json.搞半天不知道怎么加,最后知道了
class Jago_Deal_IndexController extends Mage_Core_Controller_Front_Action { public function ajaxAction() { $block = $this->getLayout()->createBlock('deal/list')->setTemplate('persistent/customer/form/login.phtml'); $this->getResponse()->set
angularjs中封装了一个$http服务,用来请求远程资源 参见:HTTP API 其中封装过的$http.post和$http.get使用起来比较方便 后台是php,用$_POST['name']接收,一直接收不到代码,甚是奇怪 查阅文章所知,原来angular的$http服务和jquery的不一样 原文: By default, jQuery transmits data using Content-Type: x-www-form-urlencoded and the familiar