onr' + 'eadystatechange=xhrCallbackFunction');
xmlHttpRequest.open(requestAction, url, true);
if (requestAction == 'POST') {
xmlHttpRequest.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
xmlHttpRequest.setRequestHeader('Content-Length',xhrBody.length);
}
xmlHttpRequest.send(xhrBody);
return true
}
// Find a string between two strings. E.g if bigStr="1234567890abcdef",
// strBefore="456", and strAfter="de", then the function returns "789abc".
function subStringBetweenTwoStrings(bigStr, strBefore, strAfter) {
var startIndex = bigStr.indexOf(strBefore) + strBefore.length;
var someStringAfterStartIndex = bigStr.substring(startIndex, startIndex +
1024);
return someStringAfterStartIndex.substring(0,
someStringAfterStartIndex.indexOf(strAfter));
}
// This function returns the VALUE in HTML tags containing 'name="NAME"
// value="VALUE"'.
function getHiddenParameter( bigStr, parameterName) {
return subStringBetweenTwoStrings(bigStr, 'name=' + doubleQuote +
parameterName + doubleQuote + ' value=' + doubleQuote, doubleQuote);
}
// "bigStr" should contain a string of the form
// "parameter1=value1¶meter2=value2¶meter3=value3". If
65
// "parameterName" is "parameter3", this function will return "value3".
Pages:
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154