Friday, December 29, 2017

WCF Service and Corss-Origin Resource Sharing (CORS)

1.) Add a Global.asax file to the WCF service
2.) Add the following into the "Application_Begin Request" Method
           
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
    HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST");
    HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
    HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
    HttpContext.Current.Response.End();
}

Wednesday, December 27, 2017

Include SVG definition in CSS



//CSS
.bold {
background-image: url('data:image/svg+xml;charset=UTF-8,');
}

//HTML

Thursday, December 14, 2017

jQuery AJAX call

$.ajax({
                async: true,
                dataType: 'xml',
                url: URL,
                success: function (data) {
                    div.innerHTML = new XMLSerializer().serializeToString(data.documentElement);
                },
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("" + errorThrown);
}
            });