Re: Problem with JavaScript
XMLHttpResponse
protected XMLHttpResponse(NativeObject options)
Creates a new instance of XMLHttpResponse.
Parameters:
options - map of response options defined in a javascript object
Re: Problem with JavaScript
DataSet=function(){
//DataSet properties
this.fields=new Array();//list of fields in DataSet row
this.fieldsl=function(){
return this.fields.length;
}
this.onResponseGetf = function(){
var fieldList=new Array();
if(Ajax.CheckReadyState(Ajax.request)){
var response = Ajax.request.responseXML;
var _response= response.getElementsByTagName('fields');
if(_response.length == 0){
document.getElementById('AjaxMessage').innerHTML = 'Missing field list.<br/>Try refreshing the page or you may have an error in the table name.';
}
else {
var _fields= response.getElementsByTagName('field');
for(var i=0; i<_fields.length; i++){
fieldList.push(response.getElementsByTagName('field')[i].firstChild.data);
(response.getElementsByTagName('field')[i].firstChild.data);
}
alert(fieldList.valueOf());
}
}
}
}
function createDataset(_f){
_newSet= new DataSet();
_newSet.URL+="&table="+_newSet._form.name;
alert(_newSet.fieldsl());
Ajax.Request(_newSet.URL+'&method=getf', _newSet.onResponseGetf,false));
alert(_newSet.fieldsl());
return _newSet;
}
Re: Problem with JavaScript
try
{
if (a === "")
err += "some error";
if (b==="")
err += "some error";
if (c==="")
{
err += "some error";
}
else
{
// use an xmlhttp request to compare a condition
// that must be evaluated from the server. the response
// is true or false.
}
}
catch{}
finally{
if (err ==="")
//submit the form
else
//let the user know about the errors.
}
Re: Problem with JavaScript
function ajaxfunc(filePath, action) {
httpReq = window.XMLHttpRequest
? new XMLHttpRequest()
: new ActiveXObject('MSXML2.XMLHTTP');
httpReq.open('GET', filePath, true);
httpReq.send(null);
httpReq.onreadystatechange = function() {
if (httpReq.readyState == 4) {
action(httpReq);
}
};
}
ajaxfunc('json.html',
function(httpReq) {
document.body.innerHTML = httpReq.responseText;
}
);