After a lot of hiccups and with a lot of help from my mentor Yaron, I finally made Select2 tokenization work on the CargoQuery page. I have redesigned the CargoQuery page and it looks like this now:
Press enter or click to view image in full size
I wrote a new API for the Cargo extension called CargoQueryAutocomplete API, which helps to fetch the Tables and Fields using AJAX. This allows user to know what tables and fields are there in the cargo database.
The most challenging part was to display the fetched response. Somehow select2 was quite tricky to implement.
In the upcoming weeks I will continue with Validation and Tooltips for every input field.