DOM object constructor cannot be called as a function
html, javascript, web-services
Solution
Change
var xmlString = XMLSerializer().serializeToString(data);
to
var xmlString = new XMLSerializer().serializeToString(data);
The reason it throws the error is because you are trying to invoke XMLSerializer as a function instead of instantiating it.
Problem
I have this function on javaScript, and works on Firefox, but on google chrome not ``` function sendInfo(userId, Code) { // text with all info to send to controller var values = { "token": Code, "code": userId } // POST THE CHANGE HERE TO THE DATABASE var url = "WSHolFacebook.asmx/saveToken"; $.post(url, values, function (data) { if (window.ActiveXObject) { return data.xml; } var xmlString = XMLSerializer().serializeToString(data); var xml = xmlString, xmlDoc = $.parseXML(xml), $xml = $(xmlDoc), $title = $xml.find("string"); var texto = $title.text(); if ($title.text() == "Success") { window.location = '<%=ConfigurationManager.AppSettings["successUrl"].ToString() %>' } else { window.location = '<%=ConfigurationManager.AppSettings["errorUrl"].ToString() %>' } }) } ``` the error in chrome it is: Uncaught TypeError: DOM object constructor cannot be called as a function.