AJAX - Full Array of Parameters
From All n One's bxp software Wixi
(Redirected from AJAX - Full Array of Paramters)
To save a lot of repeating code, the majority of the functionality use the same parameters.
All of the functionality is coded into the publicly available library fn_javascript_ajax_campaign.js. https://ww3.allnone.ie/library/javascript/fn_javascript_ajax_campaign.js
bxp creates an array to store the parameters. Not all parameters are being used by all functions.
//================================================================
// Variable Initialisation
//================================================================
//Initialising the settings array, and for clarity explaining the elements of the array.
//Simply copy this block of data into your code and replace the values with your system values
//Not that the automation user MUST have an IP Address set for the system to work
//-----------------------------------------------------------------------------------------
aryAjax_Settings[0] = "client_demo"; //The system to use
aryAjax_Settings[1] = "demo"; //The automation username
aryAjax_Settings[2] = "password"; //The automation users password
aryAjax_Settings[3] = "1"; //The Id of the campaign
aryAjax_Settings[4] = "strCDA_1_field_0_0"; //The search field
aryAjax_Settings[5] = "1"; //The search value
aryAjax_Settings[13] = "-1"; //Id of the current record, used for delimiting and not repeating current case
aryAjax_Settings[14] = "true"; //Click through to campaign?
aryAjax_Settings[15] = "divWarning"; //The id of the destination to which the table will be inserted
aryAjax_Settings[16] = "Table"; //The default option is to create a table to display. The other options is Insert. Which will insert the values into the relevant fields.
//The fields to be returned into the array
//The column names of those fields
//The first field must always be the ID of the campaign
aryAjax_Settings[6] = "intCDA_1_Id,strCDA_1_field_0_0,strCDA_1_field_0_1";
aryAjax_Settings[12] = "Id,Field 1,Field 2";
aryAjax_Settings[17] = "intCDA_1_Id,strCDA_1_field_0_0,strCDA_1_field_0_1"; //For insertion, what local campaign fields will the data be transferred into.
//-----------------------------------------------------------------------------------------
// Extra settings fields used by the function, but made available globally for testing
aryAjax_Settings[7] = ""; //Constructed URL for retrieveing data
aryAjax_Settings[8] = "-1"; //Error Status
aryAjax_Settings[9] = ""; //Error Translation
aryAjax_Settings[10] = "-1"; //Record count
aryAjax_Settings[11] = ""; //Alternate Destination if required. Constructed just before use
//-----------------------------------------------------------------------------------------
aryAjax_Settings[18] = "true"; //Show table if empty? By default always show something.
aryAjax_Settings[19] = ""; //Custom sort order if needed
aryAjax_Settings[33] = ""; //Custom sort orderDESC
aryAjax_Settings[20] = ""; //Custom group by if needed
aryAjax_Settings[21] = "false"; //Limit to My Records only
aryAjax_Settings[22] = ""; //Auto Login - System
aryAjax_Settings[23] = ""; //Auto Login - User
aryAjax_Settings[24] = ""; //Auto Login - SessionId
//--Live Search----------------------------------------------------------------------------
aryAjax_Settings[25] = ""; //Field to Update (Id Value)
aryAjax_Settings[26] = ""; //Function After Update
aryAjax_Settings[27] = ""; //Field to Update (Display Text)
//--Post Data Rerrieval Execution----------------------------------------------------------
aryAjax_Settings[28] = ""; //Generic function call
//--Live Search Format Options-------------------------------------------------------------
aryAjax_Settings[29] = ""; //Buttons in the first column or the last column --> First/Last
aryAjax_Settings[30] = ""; //Multi - button functionality --> Two colours
aryAjax_Settings[31] = ""; //Button Text (multi separated by ',' --> XXXXXXXX,XXXXXXX
aryAjax_Settings[32] = ""; //Value for matching to show button 2 --> XXXXXXX
//--Order Options----------------------------------------------------------------------------
aryAjax_Settings[33] = ""; //Sort descending
//--AJax Data Insert/Update/Delete Parameters----------------------------------------------------------------------------
aryAjax_Settings[34] = ""; //Fields to insert to
aryAjax_Settings[35] = ""; //Values to insert
aryAjax_Settings[36] = ""; //Field to search on
aryAjax_Settings[37] = ""; //Value to search with
aryAjax_Settings[38] = ""; //Add a CCl
aryAjax_Settings[39] = ""; //divName
//--All System Management Parameter--------------------------------------------------------------------------------------
aryAjax_Settings[40] = "500"; //Total limit
//Please note that fields 4 and 5 will be ignored if 41 is used (4 and 5 still need to be filled in)
//i.e. aryAjax_Settings[41] = "strCDA_X_field_0_0 = 'Current' And intCDA_X_Id > '6'"
aryAjax_Settings[41] = ""; //Complex Where clause