Php 如何使用jQuery执行POST json请求?
如何使用jquery重新创建与此PHP请求完全相同的请求Php 如何使用jQuery执行POST json请求?,php,jquery,zend-framework,Php,Jquery,Zend Framework,如何使用jquery重新创建与此PHP请求完全相同的请求 $client = new Zend_Http_Client($uri); $response = $client->setMethod(Zend_Http_Client::POST) ->setRawData(trim($json), 'application/json') ->request(); 谢谢。像这样 $.ajax({ cac
$client = new Zend_Http_Client($uri);
$response = $client->setMethod(Zend_Http_Client::POST)
->setRawData(trim($json), 'application/json')
->request();
谢谢。像这样
$.ajax({
cache:false,
type: 'POST',
url: "yoururl",
data:yourJsonData,
contentType: "application/json",
success: function(data) {
//do what you what with return data
}
});
$.postJSON("/application/json".
{
ID:5 // all parameters here for the method
},
function(data)
{
//data is what comes back from your function
});
postJSON不是正式的jquery函数。。。但它确实有效