Giter VIP home page Giter VIP logo

Comments (6)

pwarelis avatar pwarelis commented on July 18, 2024

The data is pre-parsed by jQuery. Internally I call $.ajax() on every request.
Check the raw response of your Java method, because it seems to me that you're
returning a string. I've tested this with objects and arrays, no problems.
The raw response for an array should be:

["Ajax","Ajax-Typeahead"]

Can you confirm that this is what you're receiving?

from ajax-typeahead.

bane73 avatar bane73 commented on July 18, 2024

Paul, sorry for the delay in getting back to you -- I was on vacation over the weekend.

Sorry for this - you're right. When I booted the machine this morning and removed the ref to $.parseJSON(data), it just worked. I had definitely tried it originally without that and it wasn't working; guess I'm going to chalk it up to my IDE being out-of-sync or something since I rarely reboot or restart GF.

Thanks for the awesome code, yours is the better of the options I've seen and is very flexible.
:)

from ajax-typeahead.

pwarelis avatar pwarelis commented on July 18, 2024

Glad to hear it works for you Brandon.
You're welcome

from ajax-typeahead.

aardalich-old avatar aardalich-old commented on July 18, 2024

Hey pwarelis, great added functionality that I'm trying to use.

I'm having the same issue bane73 was.

Eg.
If I simply hard code a ajax reply from php as echo '["Ajax","Ajax-Typeahead"]'; or echo json_encode('["Ajax","Ajax-Typeahead"]');
What is returned becomes, ["Ajax","Ajax-Typeahead"] or "["Ajax","Ajax-Typeahead"]"

and every individual letter becomes a result item the way bane73 describes.

Doing my head in, not sure what I should be returning to get whole words :)

Thanks

from ajax-typeahead.

pwarelis avatar pwarelis commented on July 18, 2024
header('Content-type: application/json');
echo json_encode(array("string1", "string2"));
exit;

from ajax-typeahead.

aardalich-old avatar aardalich-old commented on July 18, 2024

ah, awesome

Thanks for your help

from ajax-typeahead.

Related Issues (6)

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.