Setting the content-type of requests performed by jQuery jqGrid

How you can find in the code of grid.base.js the $.ajax call filling the grid contain looks like following: $.ajax($.extend({ url: ts.p.url, type: ts.p.mtype, dataType: dt, data: $.isFunction(ts.p.serializeGridData) ? ts.p.serializeGridData.call(ts, ts.p.postData) : ts.p.postData, complete: function (req, st) { … } … }, $.jgrid.ajaxOptions, ts.p.ajaxGridOptions)); So you can use ajaxGridOptions option of jqGrid to set or … Read more

HTML Input=”file” Accept Attribute File Type (CSV)

Well this is embarrassing… I found the solution I was looking for and it couldn’t be simpler. I used the following code to get the desired result. <input id=”fileSelect” type=”file” accept=”.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel” /> Valid Accept Types: For CSV files (.csv), use: <input type=”file” accept=”.csv” /> For Excel Files 97-2003 (.xls), use: <input type=”file” accept=”application/vnd.ms-excel” … Read more

Proper MIME media type for PDF files

The standard Media Type (formerly known as MIME types) is application/pdf. The assignment is defined in RFC 3778, The application/pdf Media Type, referenced from the Media Types registry. Media Types are controlled by a standards body, The Internet Assigned Numbers Authority (IANA). This is the same organization that manages the root name servers and the … Read more

How do you send a HEAD HTTP request in Python 2?

urllib2 can be used to perform a HEAD request. This is a little nicer than using httplib since urllib2 parses the URL for you instead of requiring you to split the URL into host name and path. >>> import urllib2 >>> class HeadRequest(urllib2.Request): … def get_method(self): … return “HEAD” … >>> response = urllib2.urlopen(HeadRequest(“http://google.com/index.html”)) Headers … Read more