Use this function to add a lead in the database. This function must be called only from 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 ak__source
<page name="add_lead"> <cfg> <userrights> <userright name="ALLUSER"/> </userrights> <frames> <frame name="content" processname="add_lead"/> </frames> <maintemplate>maintemplates\maintemplate_empty.html</maintemplate> <content_type><#content_type></content_type> </cfg> </page>
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) |
Code | Description |
---|---|
111 | One mandatory parameter is missing |
119 | Wrong parameter values |
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(); } }