Should Jquery code go in header or footer?

Put Scripts at the Bottom The problem caused by scripts is that they block parallel downloads. The HTTP/1.1 specification suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is … Read more

How to add an Access-Control-Allow-Origin header

So what you do is… In the font files folder put an htaccess file with the following in it. <FilesMatch “\.(ttf|otf|eot|woff|woff2)$”> <IfModule mod_headers.c> Header set Access-Control-Allow-Origin “*” </IfModule> </FilesMatch> also in your remote CSS file, the font-face declaration needs the full absolute URL of the font-file (not needed in local CSS files): e.g. @font-face { … Read more

Request header field Access-Control-Allow-Headers is not allowed by Access-Control-Allow-Headers

I had the same problem. In the jQuery documentation I found: For cross-domain requests, setting the content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or text/plain will trigger the browser to send a preflight OPTIONS request to the server. So though the server allows cross origin request but does not allow Access-Control-Allow-Headers , it will … Read more

C++ #include guards

The preprocessor is a program that takes your program, makes some changes (for example include files (#include), macro expansion (#define), and basically everything that starts with #) and gives the “clean” result to the compiler. The preprocessor works like this when it sees #include: When you write: #include “some_file” The contents of some_file almost literally … Read more

jQuery and AJAX response header

cballou’s solution will work if you are using an old version of jquery. In newer versions you can also try: $.ajax({ type: ‘POST’, url:’url.do’, data: formData, success: function(data, textStatus, request){ alert(request.getResponseHeader(‘some_header’)); }, error: function (request, textStatus, errorThrown) { alert(request.getResponseHeader(‘some_header’)); } }); According to docs the XMLHttpRequest object is available as of jQuery 1.4.