jQuery UI Dialog

by naveen

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/base/jquery-ui.css">
<input type="button" value="Add Value" class="button" />
<div class="Text_dialog" title="Basic modal dialog">
    TextValue: <input type="text" class="txtValue" />

JavaScript

$(function() {
    $('.button').live('click', function() {
        $('.Text_dialog').dialog('open');
    });

    $('.Text_dialog').dialog({
        autoOpen: false,
        buttons: {
            'Ok': function() {
                var textValue = $(':txtValue').val();
                $.ajax({
                    url: '/Home/About',
                    type: 'POST',
                    data: {
                        str: textValue
                    },
                    success: function(result) {
                        alert(result.val);
                    }
                });
            },
        }
    });
});