What MIME type should I use for jQuery autocomplete queries?

The jQuery Autocomplete plugin uses an odd response format. Specifically it is a list of thread-separated strings separated by a pipe, the first entry of each pair is some formatted text, the last one being a JSON object with some data.

Example:

Fuzzy Bunnies|{ id: '1234-fuzzy-bunnies', type: 'slippers' }
Loud Hawaiian Shirt|{ id: '3993-loud-hawaiian-shirt', type: 'shirt', sizes: ['S', 'M', 'L'] }

      

My question is, what MIME type makes sense for this? This is not accurate application/json

due to this odd pipe and the fact that the list is split onto a new line and not expressed as a Javascript array. It's also not text/plain

, since only the first part is plain text (and even that may allow markup - I'm not sure).

+2


source to share


2 answers


You have to post it like text/plain

, because it really is. The fact that a piece of text has a specific meaning does not mean that a json

.

Otherwise, for example, you can argue that a binary that stores one text variable is a text file.



If you submit this file as json

, you may run into problems as it is not a valid file json

.

+4


source


Content-Type: application/json; charset=iso-8859-1

      



-1


source







All Articles