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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With