inserting values in database sql server 2008 in mvc through javascript/
<p>I want to insert the values in database in my MVC application but I am getting the values through javascript.Please tell me how shall I do ,is there any way through which we can handle javascript in mvc application.Please suggest some useful resources.</p>

<p>my code of javascript is regarding the dynamic fields creation through which the user creates dynamic fields .I am getting the values from the user please tell me what shall I do.</p>

<p>the javascript code is as follows:</p>

<pre><code>&lt;script language="javascript" type ="text/javascript" &gt;

function addRow(tableID) {

    var elem = document.getElementById("linkid");
    if (typeof elem.onclick == "function") {
        elem.onclick.apply(elem);
    }

    var table = document.getElementById(tableID);

    var rowCount = table.rows.length;
    if (rowCount &lt; 25) {
        var row = table.insertRow(rowCount);

        var cell1 = row.insertCell(0);
        var element1 = document.createElement("input");
        element1.type = "checkbox";
        cell1.appendChild(element1);


        var cell2 = row.insertCell(1);
        var element2 = document.createElement("input");
        element2.type = "text";
        cell2.appendChild(element2);


        var cell3 = row.insertCell(2);
        var element3 = document.createElement("input");
        element3.type = "text";
        cell3.appendChild(element3);

        var cell4 = row.insertCell(3);
        var element4 = document.createElement("a");
        element4.setAttribute("href", "#");
        var anchortext = document.createTextNode('Edit');
        element4.appendChild(anchortext);
       // cell4.appendChild(element4);



    }
    else {
        alert("you can add only upto 25 fields");
    }

}
function deleteRow(tableID) {
    try {
        debugger;
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length; 1
        for (var i = 0; i &lt; rowCount; i++) {
            var row = table.rows[i];
            var chkbox = row.cells[0].childNodes[0];
            if (null != chkbox &amp;&amp; true == chkbox.checked) {
                table.deleteRow(i);
                rowCount--;
                i--;
            }

        }
    } catch (e) {
        alert(e);
    }
}

function hideVisible(divid, divid1) {
    try {

        if (divid == "Advertiser") 
        {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("advertiser_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Advertiser";

                }


            }
        }


        if (divid == "Brand") 
        {
            if (document.getElementById(divid).style.display == "block") 
            {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none")
                 {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("brand_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Brand";

                }


            }
        }




        if (divid == "Target") 
        {
            if (document.getElementById(divid).style.display == "block") 
            {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") 
                {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Target_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Target";

                }


            }
        }




        if (divid == "Timing") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Timing_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Timing";

                }


            }
        }


        if (divid == "Program") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Program_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Program Scope";

                }


            }
        }



        if (divid == "Media") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Media_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Media Buy";

                }


            }
        }

        if (divid == "Distribution") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Distribution_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Distribution Goal";

                }


            }
        }



        if (divid == "Added") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Added_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Added Value";

                }


            }
        }



        if (divid == "Objective") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Objective_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Objective";

                }


            }
        }

        if (divid == "Strategy") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Strategy_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Strategy";

                }


            }
        }

        if (divid == "Market") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Market_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Market Research";

                }


            }
        }



        if (divid == "Refusal") {
            if (document.getElementById(divid).style.display == "block") {
                document.getElementById(divid).style.display == "none"
                document.getElementById(divid).style.visibility = "hidden";
                if (document.getElementById(divid1).style.display == "none") {
                    document.getElementById(divid1).style.display = "block"
                    document.getElementById(divid1).style.visibility = "visible";
                    var text = document.getElementById("Refusal_Text");
                    text.setAttribute("class", "newtext1");
                    text.value = "Right of First Refusal Date";

                }


            }
        }














    }
    catch (e) {
        alert(e);
    }
}




&lt;/script&gt;
</code></pre>

<p>Thanks in advance
Ritz</p>
