Add contact

From PokeTALK developers

Jump to: navigation, search

Contents

Description

Add new contact to user addressbook

Usage

    ptAddressbook.add_contact(contact_name, company, prefix, number, prefix_1, number_1, prefix_2, number_2, email, callback);

or

    var result = ptAddressbook.add_contact(contact_name, company, prefix, number, prefix_1, number_1, prefix_2, number_2, email);

Parameters

Required Name Type Description
required contact_name string new contact name
optional company string contact company
optional prefix string first phone country prefix
optional number string first phone number (landline)
optional prefix_1 string second phone country prefix
optional number_1 string second phone number (mobile)
optional prefix_2 string third phone country prefix
optional number_2 string third phone number (office)
optional email string contact e-mail
optional callback function optional callback function to call after execution

Response

object (JSON)

 
    {"result":boolean}
Parameter Type Description
result boolean returns true if new contact added, false otherwise.

Example

Use result object

var data = ptAddressbook.add_contact(contact_name, company, prefix, number, prefix_1, number_1, prefix_2, number_2, email);
if(data.result){
    alert("New contact added");
}else{
    alert("Can`t add new contact");
}

Use callback function

ptAddressbook.add_contact(contact_name, company, prefix, number, prefix_1, number_1, prefix_2, number_2, email, function(data){
    if(data.result){
        alert("New contact added");
    }else{
        alert("Can`t add new contact");
    }
});