Web-based Ajax call

Source: Internet
Author: User

VaR id = crmform. All. new_productpricelevel_kz.datavalue [0]. idvar nssbh = crmform. All. new_name.datavalue; // obtain the product code var xml = "" + "<? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> "+" <Soap: envelope xmlns: Soap = \ "external" xmlns: xsi = \ "external" xmlns: XSD = \ "http://www.w3.org/2001/xmlschema\"> "+ generateauthenticationheader () + "<soap: body> "+" <retrieve xmlns = \ "comment"> "+" <entityname> new_productpricelevel_kz </entityname> "+" <ID> "+ ID +" </ID> "+" <columnset XM LNS: 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; // get the user idvar xml = "" + "<? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> "+" <Soap: envelope xmlns: Soap = \ "external" xmlns: xsi = \ "external" 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: envelo PE> "+" "; 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. s End (XML); var resultxml = XMLHttpRequest. responsexml; var userid = resultxml. getelementsbytagname ("userid") [0]. childnodes [0]. nodevalue; // obtain the Department idvar xml = "" + "<? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> "+" <Soap: envelope xmlns: Soap = \ "external" xmlns: xsi = \ "external" xmlns: XSD = \ "http://www.w3.org/2001/xmlschema\"> "+ generateauthenticationheader () + "<soap: body> "+" <retrieve xmlns = \ "comment"> "+" <entityname> systemuser </entityname> "+" <ID> "+ userid +" </ID> "+" <columnset xmlns: q1 = \ "H Ttp: // 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. setrequest Header ("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 // obtain the Department website var xml = "" + "<? XML version = \ "1.0 \" encoding = \ "UTF-8 \"?> "+" <Soap: envelope xmlns: Soap = \ "external" xmlns: xsi = \ "external" xmlns: XSD = \ "http://www.w3.org/2001/xmlschema\"> "+ generateauthenticationheader () + "<soap: body> "+" <retrieve xmlns = \ "comment"> "+" <entityname> businessunit </entityname> "+" <ID> "+ bmid +" </ID> "+" <columnset xmlns: q1 = \ "HT TP: // 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. setrequesth Eader ("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. token </ywlx_dm> <token> token </token> </reqhead> <reqbody> <nssbh> "+ nssbh +" </nssbh> <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 ("processed products:" + cpmc + "Start Time:" + begindatevalue + "End Time:" + enddatevalue + ""); crmform. all. new_fwbh.datavalue = fwbh; crmform. all. new_yxqq.datavalue = new date (begindatevalue); crmform. all. new_yxqz.datavalue = new date (enddatevalue );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.