Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Send proper content-type
- header('Content-Type: application/json');
- if(isset($_POST['id'])) {
- //Get data from database here
- //and serve it with
- //json_encode()
- echo json_encode(
- array(
- array('id' => 1, 'name' => 'Human'),
- array('id' => 2, 'name' => 'Orc'),
- array('id' => 3, 'name' => 'Dwarf'),
- )
- );
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement