User Tools

Site Tools


en:public:developer:template_system:tags:api:add_lead

<#Add_Lead>

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

CfgPages configuration

<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>&lt;#content_type&gt;</content_type>
  </cfg>
</page>

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();
  }
}
en/public/developer/template_system/tags/api/add_lead.txt · Last modified: 2013/03/30 18:08 by svanderclock