2

I am developing a web application using MVC .net framework. In the user interface of this application i want to create a tab when a button is clicked. following is the method i am creating this tab when a button is clicked in the user interface

$('#tabs').tabs("add", 'uploadnewcv', 'Add New CV');

while i creating this tab i want to add content in to this tab. the post method retrieve data and that data is in the data variable. i want to add that data in to the tab i created. could some one having experience on this guide me how to add content in to tab while it is creating. thanks in advance for any help

function addNewCV() {
        var text = 'xyz';

        $('#tabs').tabs("add", 'uploadnewcv', 'Add New CV');

        $.post("/AddNewCV/addnewcv", { name: text },
        function (data) {
            document.getElementById('uploadnewcv').innerHTML = data;
            //alert(document.getElementById('ui-tabs-3').innerText);
        });
    }

1 Answer 1

1

I think there's no all-in-one solution. But what you've done should work, doesn't it?
You can optimize it a bit, like this:

function addNewCV() {
    var text = 'xyz';
    $.post(
        "/AddNewCV/addnewcv",
        { name: text },
        function (data) {
            $('#tabs').tabs("add", 'uploadnewcv', 'Add New CV');
            $('#uploadnewcv').html(data);
            //alert($('#ui-tabs-3').text());
        }
    );
}

So the tab is generated when the data are already there.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.