Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I came across this plugin online. It enables me to add a selected text from one side and then add it to another side. I have intergrated it well in my project but i would love to display the text from my table in my database. Below is the definition of some of the text i have added to it but want this text to be populated from my database since they can change at anytime. The jquery plugin i'm using is pickList plugin. I do have an idea that i would need to make use of Ajax to achieve this but i still need a bit more explanation and guide





var val = {
                 01: { id:01, text: 'HYGEIA HMO LIMITED ' },
                 02: { id:02, text: 'TOTAL HEALTH TRUST LIMITED' },
                 03: { id:03, text: 'CLEARLINE INTERNATIONAL LIMITED' },
};
 var pick = $("#pickList").pickList({ data: val });



Here is just a simple of sample code. If you have used this plugin before or something similar and has been able to populate the text from db, kindly give an insight. Thanks. I'm using asp.net anyway

What I have tried:

i have only tried to write each text to the pickList. I just need a headstart or hint
Posted
Comments
Richard Deeming 8-Feb-17 10:48am    
When you're using a plugin, it's always helpful to tell us which one.

Based on your code sample, I'm guessing it's this one[^]?
Mcbaloo 9-Feb-17 4:56am    
You're very correct. That's the plugin i'm using. I was able to send data to it but it's display it as an array rather than display each data line by line . This is how the ouptut looks like {Inpatient, Outpatient, Surgery} etc Rather than Inpatient
Outpatient
Surgery
j snooze 9-Feb-17 17:51pm    
Not sure if this is what you're asking but I have used other jquery plugins that take data in the json format which the above appears to be. Generally I make an object with the properties its looking for, create a List<dataobject>. Then use the newtonsoft json helper to serialize that list and send it to your jquery. If you want to use ajax then make the method a service call. If this is MVC its easy enough to have the action result be a jsonresult. Hope this helps or at least gives you some ideas to continue searching for samples.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900