Right now what i am doing is that i append few parameters in url and post that url to server which revert me the something. this is working fine till now. Url is
var uri = "test.html?isJSON=true";
AIM.download(uri,{'onStart' : function(){return true;}, 'onComplete' : function(response){
if(response==undefined || response=="")
return;
setMessage("generateMessage",response,"error");
}});
AIM = {
frame : function(c,u) {
var n = 'f' + Math.floor(Math.random() * 99999);
var token = "";
if(u==undefined || u=="")
u="about:blank";
if(JSLI.TOKEN_VALUE && JSLI.TOKEN_VALUE !=""){
if(u && u.indexOf('?') != -1) {
u = u + '&' +JSLI.TOKEN_NAME+"="+JSLI.TOKEN_VALUE;
} else {
u = u + '?' +JSLI.TOKEN_NAME+"="+JSLI.TOKEN_VALUE;
}
}
var d = document.createElement('DIV');
d.innerHTML = '<iframe style="display:none" src="'+ u +'" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>';
document.body.appendChild(d);
var i = document.getElementById(n);
if (c && typeof(c.onComplete) == 'function') {
i.onComplete = c.onComplete;
}
return n;
},
form : function(f, name) {
f.setAttribute("action", attachToken(f.action));
f.setAttribute('target', name);
},
submit : function(f, c) {
AIM.form(f, AIM.frame(c));
if (c && typeof(c.onStart) == 'function') {
return c.onStart();
} else {
return true;
}
},
loaded : function(id) {
var i = document.getElementById(id);
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames[id].document;
}
if (d.location.href == "about:blank"
&& i.src == "about:blank") {
return;
}
if(d.location.href.indexOf("login.html?expired=true")!=-1){
document.location.href = "login.html?expired=true";
return;
}
if (typeof(i.onComplete) == 'function') {
i.onComplete(d.body.innerHTML);
}
},
download:function(u,c)
{
AIM.frame(c,u);
if (c && typeof(c.onStart) == 'function') {
return c.onStart();
} else {
return true;
}
}
};
Till here code is working good. Now i want to send a text data also which i can't send by doing append in uri. so i create a form but m not able to solve how to send this form value using this method.
<form id="frmKey" name="frmKey">
<input type="hidden" name="txt" id="txt"/>
</form>