Reputation: 39364
I have a JQuery plugin where I have the following:
transformResult: function(response, originalQuery) {
}
Inside this function I need to convert the originalQuery Json data:
[
{ "Id": 4, "Title": "Title 4" },
{ "Id": 2, "Title": "Title 2" }
]
Into the response Json data format:
{
suggestions: [
{ data: "4", value: "Title 4" },
{ data: "2", value: "Title 2" }
]
}
Id is the data and Title is the value.
How can I do this?
Thank you, Miguel
Upvotes: 0
Views: 62