JSFiddle - React, Tailwind, and code Playground

by doug65536

JavaScript

jQuery.ajaxPrefilter(function(options) {
    if (options.crossDomain && jQuery.support.cors) {
      options.url = (window.location.protocol === 'http:' ? 'http:' : 'https:') +
                    '//cors-anywhere.herokuapp.com/' + options.url;
    }
});

(function(DOMParser) {  
    "use strict";  
    var DOMParser_proto = DOMParser.prototype  
      , real_parseFromString = DOMParser_proto.parseFromString;

    // Firefox/Opera/IE throw errors on unsupported types  
    try {  
        // WebKit returns null on unsupported types  
        if ((new DOMParser).parseFromString("", "text/html")) {  
            // text/html parsing is natively supported  
            return;  
        }  
    } catch (ex) {}  

    DOMParser_proto.parseFromString = function(markup, type) {  
        if (/^\s*text\/html\s*(?:;|$)/i.test(type)) {  
            var doc = document.implementation.createHTMLDocument("")
              , doc_elt = doc.documentElement
              , first_elt;

            doc_elt.innerHTML = markup;
            first_elt = doc_elt.firstElementChild;

            if (doc_elt.childElementCount === 1
                && first_elt.localName.toLowerCase() === "html") {  
                doc.replaceChild(first_elt, doc_elt);  
            }  

            return doc;  
        } else {  
            return real_parseFromString.apply(this, arguments);  
        }  
    };  
}(DOMParser));

if (1) {
    var scrape = 'http://foretagsfakta.se/Search';
    
    var data = {
        vid: '',
        emplexp: false,
        toexp: false,
        locexp: false,
        catexp: false,
        typexp: false,
        page: '',
        empfilt: '',
        catfilt: '',
        tofilt: '',
        typfilt: '',
        locfilt: '',
        what:'bygg',
        where: ''
    };
    
    $.post(/*'http://localhost:5000/' +*/ scrape, data, function(page) {
	    var tmp = new DOMParser();
	    var dom = $(tmp.parseFromString(page, 'text/html'));
	   ...