Difference between revisions of "JavaScript AJAX Functions"

From All n One's bxp software Wixi

Jump to: navigation, search
Line 8: Line 8:
 
"Populate_AltList"
 
"Populate_AltList"
  
This function allows you retrieve two values from another record in a database and using the two values populate both the text and value of drop down list options limited to 200 records
+
This function allows you retrieve two values from another record in a database and using the two values populate both the text and value of drop down list options limited to 200 records
  
Worked example
+
Worked example
  
 
<source lang="javascript" collapse="true" first-line="1">
 
<source lang="javascript" collapse="true" first-line="1">
  
    aryAjax_Settings[0] = 'client_demo';               //Your system name
+
    aryAjax_Settings[0] = 'client_demo';               //Your system name
             aryAjax_Settings[1] = '';                     //The CMI API Username
+
             aryAjax_Settings[1] = '';                     //The CMI API Username
             aryAjax_Settings[2] = '';                     //The CMI API User password
+
             aryAjax_Settings[2] = '';                     //The CMI API User password
             aryAjax_Settings[3] = '1';                       //The campaign which contains the product list
+
             aryAjax_Settings[3] = '1';                       //The campaign which contains the product list
             aryAjax_Settings[4] = 'strCDA_1_field_0_0';     //The field which contains the limiting / grouping factor
+
             aryAjax_Settings[4] = 'strCDA_1_field_0_0';     //The field which contains the limiting / grouping factor
             aryAjax_Settings[5] = document.getElementById('strCDA_2_field_0_59').value; //The value to limit the responses by, in this case only yes items
+
             aryAjax_Settings[5] = document.getElementById('strCDA_2_field_0_59').value; //The value to limit the responses by, in this case only yes items
             aryAjax_Settings[13] = -1;                         //Limit responses -1 do not limit
+
             aryAjax_Settings[13] = -1;                         //Limit responses -1 do not limit
             aryAjax_Settings[14] = 'false';                   //Draw a table
+
             aryAjax_Settings[14] = 'false';                   //Draw a table
             aryAjax_Settings[15] = 'divWarning';               //Where to draw error messages if any
+
             aryAjax_Settings[15] = 'divWarning';               //Where to draw error messages if any
             aryAjax_Settings[16] = 'Populate_AltList';                 //Engine to use i.e. Populate
+
             aryAjax_Settings[16] = 'Populate_AltList';                 //Engine to use i.e. Populate
 
 
             aryAjax_Settings[6] = 'intCDA_1_Id,strCDA_1_field_0_1';     //The field in the other campaign to be returned order = value, text
+
             aryAjax_Settings[6] = 'intCDA_1_Id,strCDA_1_field_0_1';     //The field in the other campaign to be returned order = value, text
 
             aryAjax_Settings[12] = 'id,Name of cust';                      //Headings for xml troubleshooting
 
             aryAjax_Settings[12] = 'id,Name of cust';                      //Headings for xml troubleshooting
             aryAjax_Settings[17] = 'strCDA_2_field_0_60';   //The field in the current campaign into which the products will be inserted.
+
             aryAjax_Settings[17] = 'strCDA_2_field_0_60';   //The field in the current campaign into which the products will be inserted.
 
              
 
              
             aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value; //Auto Login - System
+
             aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value;       //Auto Login - System
aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value; //Auto Login - User
+
            aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value;         //Auto Login - User
aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value; //Auto Login - SessionId
+
            aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value;       //Auto Login - SessionId
 
 
 
             fn_Ajax_BE_Process();
 
             fn_Ajax_BE_Process();
  
 
</source>
 
</source>
12:51, 19 March 2014 (MDT)12:51, 19 March 2014 (MDT)12:51, 19 March 2014 (MDT)12:51, 19 March 2014 (MDT)12:51, 19 March 2014 (MDT)~~
+
 
  
 
"Populate_AltList"
 
"Populate_AltList"
  
This function allows you retrieve two values from another record in a database and using the two values populate both the text and value of drop down list options limited to 200 records
+
This function allows you retrieve two values from another record in a database and using the two values populate both the text and value of drop down list options limited to 200 records
  
Worked example
+
Worked example
  
 
<source lang="javascript" collapse="true" first-line="1">
 
<source lang="javascript" collapse="true" first-line="1">
Line 60: Line 60:
 
aryAjax_Settings[17] = 'intCDA_1_Id,strCDA_1_field_0_1,strCDA_1_field_0_3,strCDA_1_field_0_6';
 
aryAjax_Settings[17] = 'intCDA_1_Id,strCDA_1_field_0_1,strCDA_1_field_0_3,strCDA_1_field_0_6';
  
aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value; //Auto Login - System
+
aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value; //Auto Login - System
aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value; //Auto Login - User
+
aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value; //Auto Login - User
aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value; //Auto Login - SessionId
+
aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value; //Auto Login - SessionId
 
aryAjax_Settings[11] = '../inboundsales/userInbound-details.asp?intCampaign_Id=1&ID=';
 
aryAjax_Settings[11] = '../inboundsales/userInbound-details.asp?intCampaign_Id=1&ID=';
  
Line 76: Line 76:
 
 
 
<source lang="javascript" collapse="true" first-line="1">
 
<source lang="javascript" collapse="true" first-line="1">
  aryAjax_Settings[0] = 'client_demo';               //Your system name
+
            aryAjax_Settings[0] = 'client_demo';               //Your system name
             aryAjax_Settings[1] = '';                     //The CMI API Username
+
             aryAjax_Settings[1] = '';                     //The CMI API Username
             aryAjax_Settings[2] = '';                     //The CMI API User password
+
             aryAjax_Settings[2] = '';                     //The CMI API User password
             aryAjax_Settings[3] = '292';                       //The campaign which contains the product list
+
             aryAjax_Settings[3] = '292';                       //The campaign which contains the product list
             aryAjax_Settings[4] = 'strCDA_292_field_0_5';     //The field which contains the limiting / grouping factor
+
             aryAjax_Settings[4] = 'strCDA_292_field_0_5';     //The field which contains the limiting / grouping factor
             aryAjax_Settings[5] = document.getElementById('strCDA_495_field_0_2').value;//The value to limit the responses by, in this case only yes items
+
             aryAjax_Settings[5] = document.getElementById('strCDA_495_field_0_2').value; //The value to limit the responses by, in this case only yes items
             aryAjax_Settings[13] = -1;                         //Limit responses -1 do not limit
+
             aryAjax_Settings[13] = -1;                         //Limit responses -1 do not limit
             aryAjax_Settings[14] = 'false';                   //Draw a table
+
             aryAjax_Settings[14] = 'false';                   //Draw a table
             aryAjax_Settings[15] = 'divWarning';               //Where to draw error messages if any
+
             aryAjax_Settings[15] = 'divWarning';               //Where to draw error messages if any
             aryAjax_Settings[16] = 'InsertCount';                 //Engine to use i.e. Populate
+
             aryAjax_Settings[16] = 'InsertCount';                 //Engine to use i.e. Populate
 
           
 
           
             aryAjax_Settings[6] = 'intCDA_X_Id';     //The field to count
+
             aryAjax_Settings[6] = 'intCDA_X_Id';     //The field to count
 
             aryAjax_Settings[12] = 'id,Name';                      //Headings for xml troubleshooting
 
             aryAjax_Settings[12] = 'id,Name';                      //Headings for xml troubleshooting
             aryAjax_Settings[17] = 'strCDA_495_field_0_7';   //The field in the current campaign into which the products will be inserted.
+
             aryAjax_Settings[17] = 'strCDA_495_field_0_7';   //The field in the current campaign into which the products will be inserted.
 
              
 
              
 
             aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value; //Auto Login - System
 
             aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value; //Auto Login - System
aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value; //Auto Login - User
+
            aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value; //Auto Login - User
aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value; //Auto Login - SessionId
+
            aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value; //Auto Login - SessionId
 
 
 
             fn_Ajax_BE_Process();
 
             fn_Ajax_BE_Process();
 
</source>
 
</source>

Revision as of 19:56, 19 March 2014

  • New Ajax function - "Populate_AltList"
  • New Ajax function - "LiveSearchTable"
  • New Ajax function - "InsertCount"


"Populate_AltList"

This function allows you retrieve two values from another record in a database and using the two values populate both the text and value of drop down list options limited to 200 records

Worked example

	    aryAjax_Settings[0] = 'client_demo';               						//Your system name
            aryAjax_Settings[1] = '';                      						//The CMI API Username
            aryAjax_Settings[2] = '';                      						//The CMI API User password
            aryAjax_Settings[3] = '1';                       						//The campaign which contains the product list
            aryAjax_Settings[4] = 'strCDA_1_field_0_0';      						//The field which contains the limiting / grouping factor
            aryAjax_Settings[5] = document.getElementById('strCDA_2_field_0_59').value; 		//The value to limit the responses by, in this case only yes items
            aryAjax_Settings[13] = -1;                         						//Limit responses -1 do not limit
            aryAjax_Settings[14] = 'false';                    						//Draw a table
            aryAjax_Settings[15] = 'divWarning';               						//Where to draw error messages if any
            aryAjax_Settings[16] = 'Populate_AltList';                 					//Engine to use i.e. Populate
		
            aryAjax_Settings[6] = 'intCDA_1_Id,strCDA_1_field_0_1';      				//The field in the other campaign to be returned order = value, text
            aryAjax_Settings[12] = 'id,Name of cust';                       				//Headings for xml troubleshooting
            aryAjax_Settings[17] = 'strCDA_2_field_0_60';   						//The field in the current campaign into which the products will be inserted.
            
            aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value;       //Auto Login - System
            aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value;          //Auto Login - User
            aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value;        //Auto Login - SessionId
			
            fn_Ajax_BE_Process();


"Populate_AltList"

This function allows you retrieve two values from another record in a database and using the two values populate both the text and value of drop down list options limited to 200 records

Worked example

		aryAjax_Settings[0] 		= 'client_demo';
		aryAjax_Settings[1] 		= '';
		aryAjax_Settings[2] 		= '';
		aryAjax_Settings[3] 		= 1;
		aryAjax_Settings[4] 		= 'strCDA_1_field_0_0';		
		aryAjax_Settings[5] 		= document.getElementById('strCDA_2_field_0_59').value;		
		aryAjax_Settings[13] 		= '-1'
		aryAjax_Settings[14] 		= 'true';
		aryAjax_Settings[15] 		= 'HospitalListPrivate';
		aryAjax_Settings[6] 		= 'intCDA_1_Id,strCDA_1_field_0_1,strCDA_1_field_0_3,strCDA_1_field_0_6';
		aryAjax_Settings[12] 		= 'Id,Hospital Name,Post Code,AMH';

		aryAjax_Settings[16] 		= 'Table';
		aryAjax_Settings[17] 		= 'intCDA_1_Id,strCDA_1_field_0_1,strCDA_1_field_0_3,strCDA_1_field_0_6';

		aryAjax_Settings[22] 		= document.getElementById('intSystemGenerated_CompanyId').value;		//Auto Login - System
		aryAjax_Settings[23] 		= document.getElementById('intSystemGenerated_UserId').value;			//Auto Login - User
		aryAjax_Settings[24] 		= document.getElementById('intSystemGenerated_LoginKey').value;			//Auto Login - SessionId
		aryAjax_Settings[11] 		= '../inboundsales/userInbound-details.asp?intCampaign_Id=1&ID=';

		fn_Ajax_BE_Process();


"InsertCount" This function counts the amount of records in the database chosen that matches the criteria entered


            aryAjax_Settings[0] = 'client_demo';               						//Your system name
            aryAjax_Settings[1] = '';                      						//The CMI API Username
            aryAjax_Settings[2] = '';                      						//The CMI API User password
            aryAjax_Settings[3] = '292';                       						//The campaign which contains the product list
            aryAjax_Settings[4] = 'strCDA_292_field_0_5';      						//The field which contains the limiting / grouping factor
            aryAjax_Settings[5] = document.getElementById('strCDA_495_field_0_2').value;		//The value to limit the responses by, in this case only yes items
            aryAjax_Settings[13] = -1;                         						//Limit responses -1 do not limit
            aryAjax_Settings[14] = 'false';                    						//Draw a table
            aryAjax_Settings[15] = 'divWarning';               						//Where to draw error messages if any
            aryAjax_Settings[16] = 'InsertCount';                 					//Engine to use i.e. Populate
														           
            aryAjax_Settings[6] = 'intCDA_X_Id';      							//The field to count
            aryAjax_Settings[12] = 'id,Name';                       					//Headings for xml troubleshooting
            aryAjax_Settings[17] = 'strCDA_495_field_0_7';   						//The field in the current campaign into which the products will be inserted.
            
            aryAjax_Settings[22] = document.getElementById('intSystemGenerated_CompanyId').value;	//Auto Login - System
            aryAjax_Settings[23] = document.getElementById('intSystemGenerated_UserId').value;		//Auto Login - User
            aryAjax_Settings[24] = document.getElementById('intSystemGenerated_LoginKey').value;	//Auto Login - SessionId
			
            fn_Ajax_BE_Process();