developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks




xmlhttprequest
sai k rishna595 10/11/2012 11:40 AM
Applications Development All Releases All Platforms


Hi team

my ajax funtion only works on the first call andafter that it does not work , i dont know why.The event is triggered via onclick event for a tab/table on a web page. The event triggers correctly however, it seems the URL calls an agent and is only sent on the first click. Subsequent clicks do not seem to activate the Lotusscript agent. Following is code. Please help

my code is as follows

function lkupDocrecds(doctype,casecode)
{

var xmlHttp;
try {
xmlHttp=new XMLHttpRequest();
}
catch (e) {
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4 && xmlHttp.status == 200 )
{
var s = new String(xmlHttp.responseText);

var temp = s.substring(s.indexOf("<body"), s.indexOf("</body"))
temp = temp.substring(temp.indexOf(">")+2, temp.length);
//alert(temp)

if(doctype.toLowerCase() == "marketing presentation")
{

if(temp.length > 2 )
{
document.getElementById('marketingdocs').innerHTML = temp;
}
refreshFrame()
}
else if (doctype.toLowerCase() == "proposal")
{

if(temp.length > 2 )
{
document.getElementById('proposaldocs').innerHTML = temp;
}
refreshFrame()
}
document.getElementById('adddocrec').focus();

}
}

var d = new Date();
var t = d.getTime();

//alert("GET", "/" + _thisDB + "/ajaxSubdocslkup?OpenAgent" + "&type=" + doctype+"&cc="+casecode+"&tme="+t );
// setTimeout(function (){},3000);
xmlHttp.open("GET", "/" + _thisDB + "/ajaxSubdocslkup?OpenAgent" + "&type=" + doctype+"&cc="+casecode+"&tme="+t,true );
xmlHttp.send(null);
}

if i put one alert in the code and run the script , it is working as expected i also tried the settimeout function as well but now luck.

Similar problem link as well

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/3284da00569c5b3e8525749800768d2d?OpenDocument&Highlight=0,ajax,agent,n%3Ft,triggered

but i did the way tey suggestion but still i did not get the results .

Please help me out

thanks
sai krishna

Go back