web方式AJAX調用

來源:互聯網
上載者:User

var id =crmForm.all.new_productpricelevel_kz.DataValue[0].idvar nsrsbh =crmForm.all.new_name.DataValue;//得到產品代碼var xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader() + "  <soap:Body>" + "    <Retrieve xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + "      <entityName>new_productpricelevel_kz</entityName>" + "      <id>"+id+"</id>" + "      <columnSet xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:AllColumns\" />" + "    </Retrieve>" + "  </soap:Body>" + "</soap:Envelope>" + "";var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");xmlHttpRequest.setRequestHeader("Content-Length", xml.length);xmlHttpRequest.send(xml);var resultXml = xmlHttpRequest.responseXML;var cpdm =resultXml.getElementsByTagName("q1:new_cpxmdm")[0].childNodes[0].nodeValue;// 得到 使用者IDvar xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader() + "  <soap:Body>" + "    <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + "      <Request xsi:type=\"WhoAmIRequest\" />" + "    </Execute>" + "  </soap:Body>" + "</soap:Envelope>" + "";var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Execute");xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");xmlHttpRequest.setRequestHeader("Content-Length", xml.length);xmlHttpRequest.send(xml);var resultXml = xmlHttpRequest.responseXML;var userID=resultXml.getElementsByTagName("UserId")[0].childNodes[0].nodeValue; //得到部門IDvar xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader() + "  <soap:Body>" + "    <Retrieve xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + "      <entityName>systemuser</entityName>" + "      <id>"+userID+"</id>" + "      <columnSet xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:AllColumns\" />" + "    </Retrieve>" + "  </soap:Body>" + "</soap:Envelope>" + "";var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");xmlHttpRequest.setRequestHeader("Content-Length", xml.length);xmlHttpRequest.send(xml);var resultXml = xmlHttpRequest.responseXML;var bmid=resultXml.getElementsByTagName("q1:businessunitid")[0].childNodes[0].nodeValue//得到部門網站 var xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader() +"  <soap:Body>" + "    <Retrieve xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + "      <entityName>businessunit</entityName>" + "      <id>"+bmid+"</id>" + "      <columnSet xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:AllColumns\" />" + "    </Retrieve>" + "  </soap:Body>" + "</soap:Envelope>" + "";var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");xmlHttpRequest.setRequestHeader("Content-Length", xml.length);xmlHttpRequest.send(xml);var resultXml = xmlHttpRequest.responseXML;webUrl =resultXml.getElementsByTagName("q1:websiteurl")[0].childNodes[0].nodeValue;var url=  webUrl .replace(";", "?");url +="<?xml version='1.0' encoding='UTF-8'?><MSG><REQHEAD><YWLX_DM>EDES.SERVICE.QUERY.QUERY_JFXX_BY_FWCP_AND_NSRSBH</YWLX_DM><TOKEN>wEPDwUJOTA5MDI0MzY0D2QWAmYPZBYCAgEPZBYEAgEPZBYCAgEPFQEUL0luY2x1ZGUvamF2YXNjcmlwdC9kAgMPZBYMAgEPZBYUZg8PFgo</TOKEN></REQHEAD><REQBODY><NSRSBH>"+nsrsbh+"</NSRSBH><FWCP_DM>"+cpdm+"</FWCP_DM></REQBODY></MSG>";xmlHttpRequest.Open("GET", url,false);xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");xmlHttpRequest.send(null);var resultXml = xmlHttpRequest.responseText;  var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");  xmlDoc.async="false";  xmlDoc.loadXML(resultXml );var begindatevalue= xmlDoc.getElementsByTagName("QSRQ")[0].childNodes[0].nodeValue;begindatevalue =begindatevalue.replace(/-/g, '/ '); var enddatevalue= xmlDoc.getElementsByTagName("JZRQ")[0].childNodes[0].nodeValue;enddatevalue=enddatevalue.replace(/-/g, '/ '); var fwbh =xmlDoc.getElementsByTagName("FWBH")[0].childNodes[0].nodeValue;var cpmc =xmlDoc.getElementsByTagName("FWCP_MC")[0].childNodes[0].nodeValue;alert("辦理產品:"+cpmc+"  起始時間:"+begindatevalue+"  截止時間:"+enddatevalue+"");crmForm.all.new_fwbh.DataValue=fwbh;crmForm.all.new_yxqq.DataValue = new Date( begindatevalue);crmForm.all.new_yxqz.DataValue= new Date( enddatevalue);
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.