I kind of see the errors of my ways, but would like some clarification. Instead of separating each element with an &, I could use some other delimiter, so it will be only 1 large string which I would parse. Or as I assemble the string (see code below line 38) I could attach a row # to each element in each row ie: GroupKey1, GroupName1...., GroupKey2, GroupName2.....
Not sure what is the best option or can I just send multiple records with the same identifiers?
Each record consist of just 4 fields
GROUPKEY = GROUPNAME + JDEPTID + PHASECODE
GROUPNAME
JDEPTID
PHASECODE
Expand|Select|Wrap|Line Numbers
- /*
- Ajax communication with server section
- for submtting updated templates.
- */
- var tempHttp;
- function submitTemplates()
- {
- if (window.ActiveXObject)
- {
- tempHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }else if (window.XMLHttpRequest) {
- tempHttp = new XMLHttpRequest();
- }
- var url = "upDateTemplates.exe?timeStamp=" + new Date().getTime();
- var queryString = buildQueryString();
- tempHttp.onreadystatechange = handleStateChange;
- tempHttp.open("POST", url, true);
- tempHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- tempHttp.send(queryString);
- }
- function buildQueryString()
- {
- var cG = ""
- var cD = ""
- var cP = ""
- var cString = ""
- for (i in aTemplates )
- {
- cG = i;
- for (n in aTemplates[i])
- {
- cD = n.substring(1);
- for (p in aTemplates[i][n] )
- {
- cP = p.substring(1);
- cString += "GROUPKEY="+cG+cD+cP+"&GROUPNAME="+cG+"&JDEPTID="+cD+"&PHASECODE="+cP+"&"
- }
- }
- }
- cString += "method=POST";
- return cString;
- }