Skip to content


Creating your first JSON service request

In this example we are going to create a web service which returns a JSON formatted string. This request could be called from almost any type of AJAX or Javascrpt HTTP Request which expects a JSON formatted response.

Test the example: http://kerkness.ca/kerkdemo/hello.world

Example 1

Create the directory kerk/modules/hello/

Inside the ‘hello’ directory create the file ‘world.php’ and add the following to it.

<?php
    $kerk->addContent('myvar', 'Hello World');
?>

Now you can make a request for this service by calling http://kerkness.ca/kerkdemo/hello.world and see the following response

{"content":{"myvar":"Hello World"}}

Next

Creating your first HTML service request

Posted in Tutorials.

Tagged with , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.



close