Git Product home page Git Product logo

Comments (5)

dyve avatar dyve commented on July 29, 2024

correct, will fix

On Tue, Feb 14, 2012 at 18:25, zack
[email protected]
wrote:

with remoteDataType: 'json'

  • was getting error 'results is null', the following fix worked for me
    .. I dont believe its necessary to parse json if the content headers are set correctly
$.Autocompleter.prototype.parseRemoteData = function(remoteData) {        var remoteDataType = this.options.remoteDataType;        if (remoteDataType === 'json') {            //return $.parseJSON(remoteData);  // not needed?            return remoteData;        }        return plainTextParser(remoteData, this.options.lineSeparator, this.options.cellSeparator);    };

Reply to this email directly or view it on GitHub:
#15

from jquery-autocomplete.

zackd avatar zackd commented on July 29, 2024

ah btw, just ran into another related issue..

found I needed to explicity set contentType: "application/json; charset=utf-8"

  • possibly this is a bug with jquery1.6.4
  • docs state that contentType gets set automatically, but in my case no contentType header was being sent

from jquery-autocomplete.

dyve avatar dyve commented on July 29, 2024

I think I'll just revert to always using text and manually parsing
json through $.parseJSON, has always worked well, except for setting
content headers

On Tue, Feb 14, 2012 at 19:20, zack
[email protected]
wrote:

ah btw, just ran into another related issue..

found I needed to explicity set contentType: "application/json; charset=utf-8"

  • possibly this is a bug with jquery1.6.4
  • docs state that contentType gets set automatically, but in my case no contentType header was being sent

Reply to this email directly or view it on GitHub:
#15 (comment)

from jquery-autocomplete.

zackd avatar zackd commented on July 29, 2024

yeah, but if the headers are set correctly for json its parsed automatically by jquery.ajax

..and if they are not set correctly for json.. there will be problems if the backend is expecting correct json headers

from jquery-autocomplete.

zackd avatar zackd commented on July 29, 2024

btw my previous comment about 'explicity setting contentType' was not relevant, due to a mis-understanding of http headers more than anything:

  • setting Content-Type header on a GET request is not required (jquery does not set it - as I noted before),
  • Accept header should be sufficient to indicate that the required response type should be e.g. application/json

from jquery-autocomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.