How Can I Get The Value Of A Textfield From Database In Update Form

I’m using Yii framework Update form to get values from backend, I created a add/remove textfields feature in my form. I’m able to use the create form easily. But, I have a problem in update form.

Below is the code -

$(function () {

    var json = {

        "welcomeList": ["Thanks for coming", "Please select from the following list", "dwadwadsds"],

            "endList": ["Press come again", "Press 0"]


    $.each(json.welcomeList, function (_, vv) {

        $('<p><label for="p_scnts"><input type="text" class=cnt" size="20" name="p_scnt" value="' + vv + '"placeholder="Input Value" /></label> <a href="#" id="remScnt">Remove</a></p>').appendTo('#p_scents');


    var scntDiv = $('#p_scents');

    var i = $('#p_scents p').size() + 1;

    $('#addScnt').live('click', function () {

        $('<p><label for="p_scnts"><input type="text" id="p_scnt_' + i + '" size="20" name="p_scnt_' + i + '" value="" placeholder="Input Value" /></label> <a href="#" id="remScnt">Remove</a></p>').appendTo(scntDiv);


        return false;


    $('#remScnt').live('click', function () {

        if (i > 2) {




        return false;



In the above code, I want to replace the hardcoded value of var json with the value from the database to the textfield. How can I do this?