# The Webba booking Api

Since the version 2.2.2, Webba Booking has a JavaScript API.

## Syntax

wbk_on_booking( service, time, name, email, phone, desc, quantity );

## Parameters

service – numeric id of the service booked.

time – time of appointment in UNIX timestamp format.

name – name provided by a customer.

email – email provided by a customer.

phone – phone provided by a customer.

desc – description provided by a customer.

### Description

This function is called on the successful response on booking. You can use it to perform actions like redirect, analytics tracking, changing HTML, custom output, etc.

### Where should I declare this function?

It does not matter where you put the declaration. You can put it in your theme files or use an external plugin for custom js code. The only one thing to pay attention is – make sure that you won't lose your custom js code after updates.

### Example of code for page redirect on submission

function wbk_on_booking( service, time, name, email, phone, desc, quantity ){ window.location = "http://example.com/example.html"; }