Using jQuery.getJSON success function to change JSON result -


I am using the JQuery UI widget with one, for example if I type in "ba" So automatically expects an array of stars such as ["bat", "banana", "band", "bar"] However, to get this information, my remote function is very complex, it gives something like this {"Prefix": "ba", "weblog": "gmazza", "tagcounts": {"tag": "bat", "count": 2}, {" Tag ":" banana "," count ": 1}, {" tag ":" band "," count ": 1}, {" tag ":" bar "," count " Mr. ": 1}]}

... I need to go through the array third element" Tagged "string" tag "and return an array of values. Assuming, the most sensible solution would be to convert that function into a format that could work completely completely, but to change the format of the JSON array back to me, I want to learn how to write the parsing function with JQuery, that is, :

 . Autocomplete ({source: function (request, response) {$ .getJSON ("myURL", {term: 'ba'}, function (data) {...});}, ...});  

How can I create a "success" function which will give me the desired array of auto integer requirements? Examples of any suggestions, suggestions, code would be appreciated, compared to the 'Net I thought that finding is becoming more difficult to find. One particular problem is that I see that the most success function is the output to produce only the console or the HTML elements, I need it to return a value (JSROM array) which is the "response above my source function "Will be used as.

You set label to auto-complete to work Is required and it is related to value . As you have JSON in the following format,

  {"prefix": "ba", "weblog": "gmazza", "tagcounts": [{"tag": "bat" {"Tag": "band", "count": 1}, {"tag": "bar", " Calculation ": 1}]}  

and I believe that tagcounts.tag should be label and for the value I do not know .

} {$ .getJSON ("myURL", {term: 'ba'}, function (data) {response ($ .model (data tag, function (data value) {return {// display label label: dataValue.tag , / Auto complete value value: dataValue.tag};}))});

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -