瑞雪年

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: :: 订阅 订阅 :: 管理 ::

1. Add JSONRPC Server

wget http://ftp.drupal.org/files/projects/services-6.x-2.4.tar.gz

tar xvf  services-6.x-2.4.tar.gz

wget http://ftp.drupal.org/files/projects/jsonrpc_server-6.x-1.3.tar.gz

tar xvf  jsonrpc_server-6.x-1.3.tar.gz

2. Call Drupal JSONRPC service with Javascript

<html>
<head>
<title>Drupal JSONRPC Server Test</title>
<script type = "text/javascript" src="jquery-1.5.1.min.js"></script>
</head>
<body>
<script type = "text/javascript">
$(document).ready(
function()
{
$.post(
"http://localhost/kb/services/json-rpc",
{method:
"node.get", params: "[1, []]"},
function(data)
{
alert(data.result.title);
});
});
</script>
</body>
</html>

posted on 2011-03-22 20:31  瑞雪年  阅读(304)  评论(0编辑  收藏  举报