(function () { var calcIpoteka = function () { this.url = 'https://gkk.novostroy-m.ru/mortgage/ajax?id=2921&theme=ipoteka/default'; this.method = 'GET'; this.init(); }; calcIpoteka.prototype.init = function () { if (typeof $.validator != 'function') { alert("Надо поставить jquery.validate"); return false; } this.run(); }; calcIpoteka.prototype.corsRequest = function () { var xhr = new XMLHttpRequest(); if ('withCredentials' in xhr) { // XHR for Chrome/Firefox/Opera/Safari. xhr.open(this.method, this.url, true); } else if (typeof XDomainRequest !== 'undefined') { // XDomainRequest for IE. xhr = new XDomainRequest(); xhr.open(this.method, this.url); } else { // CORS not supported. xhr = null; } return xhr; }; calcIpoteka.prototype.run = function () { var self = this; window.App = {Component: {}}; var xhr = this.corsRequest(); if (typeof xhr == 'object') { xhr.onload = function (e) { jQuery('#ipoteka-novostroy').html(xhr.responseText); return false; } xhr.send(); } }; return new calcIpoteka(); })();