====== <#Add_Lead> ====== Use this function to add a lead in the database. This function must be called only from [[en:public:developer:template_system:cfgpages]]. The Lead will be connected to the current web user (as the Buyer). The ID of the referrer (if any) of the lead will be extracted from the cookie [[en:public:developer:template_system:reserved_parameters:ak__source]] ==== CfgPages configuration ==== maintemplates\maintemplate_empty.html <#content_type> ==== Parameters ==== Parameters are taken from tag (default) or from HTTP GET/Post ^ Name ^ Mandatory ^ Default ^ Description ^ | Property.ID | No | | ID of the property on with the lead will be linked | | Lead.type | Yes | | Type of lead (2=Web or 4=Telephone) | ==== Error Codes ==== ^ Code ^ Description ^ | 111 | One mandatory parameter is missing | | 119 | Wrong parameter values | ==== Example ==== Ajax example on jQuery $.ajax({ cache: false, type: "GET", data: { Property.ID: 'CA-T1', Lead.type: 2 }, url: '<#url id="/api/add_lead/">', dataType: "xml", success: callbackfunction_on_success, error: function (jqXHR, textStatus, errorThrown) {} }); function callbackfunction_on_success (response) { var $root = $('rsp',response); if ($root.attr('stat') == 'ok'){ var leadid = $root.find('id').Html(); } }