> 1: Grab the value of a form input
> 2: Grab results of a .php page via AJAX ( $.get()?? )
> 3: Check through the AJAX results ( should i return the data as JSON?
> or just | it? )
> 4: If there is a match / likeness for what is in the form input
> addClass('error') IF NOT addClass('accept')
...
> Thanks for the replies i am actually using the autocomplete plugin for
> my live search parts, but what im trying to create is just a lookup
> which will not return any selection values but just addClass depending
> what it finds.

When returning data that is to be used directly by JavaScript (#3
above), I always prefer JSON unless there are specific reasons to do
otherwise.  (JSON is already in a JavaScript-digestible format.)

I don't know the nature of your data or what you are trying to match,
but if it is something like

Form field:  'myentry'

And the returnData = {
     myentry: "this is a real user",
     film: "at eleven"
}

Then:

//may have to test this slightly differently,
//i.e., if (returnData.hasOwnProperty('myentry') {...}
if (typeof returnData.myentry !== 'undefined') {
     ...addClass('returnDataMatches');..
} else {
     ...addClass('noMatchMan');
}

Pyro

Reply via email to