AnsweredAssumed Answered

Troubles with AJAX query in webscript

Question asked by vladislavlysov on Nov 11, 2011
Latest reply on Nov 13, 2011 by vladislavlysov
Hello!!!
    I wrote a web script that sends the AJAX request. Next code containig in file "test.get.js":

function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function startRequest(){
  var req = getXmlHttp();
  req.open("GET", "https://localhost:8443/solr/alfresco/afts?  q=TYPE:%22cm:content%22&wt=xml&facet=true&facet.field=TYPE&facet.sort=count", true);
  req.send(null);
}
 
startRequest();
But a got exception "Cannot find function open". He didn't find XMLHttpRequest. Why?
After that a read this page http://wiki.alfresco.com/wiki/AJAX_Support and change my code in accordance with YAHOO. But it doesn't work. How do I get Ajax request?
Thank you.

Outcomes