Open (Show) Bootstrap Modal Popup after AJAX Call Success in ASP.Net

Last Reply one year ago By pandeyism

Posted one year ago

i need to show/open a pop up afther the susses in ajax i tried this 

else if (result == 2) {

but doest work 

help me plz

You are viewing reply posted by: pandeyism one year ago.
Posted one year ago

Hi fr3eddy,

Refer below sample.


<script type="text/javascript" src=''></script>
<script type="text/javascript" src=''></script>
<link rel="stylesheet" href=''
    media="screen" />
<script type="text/javascript">
    $(function () {
        $("#btnSubmit").click(function () {
            var body = $('[Id*=txtName]').val();
            $("#MyPopup .modal-body").html("Welcome to " + body);
                type: "POST",
                url: "Default.aspx/SendParameters",
                data: "{name: '" + $("#txtName").val() + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (r) {
        $("#btnClosePopup").click(function () {
<!-- Bootstrap -->
<br />
<input type="text" id="txtName" value="" class="form-control" />
<br />
<input type="button" id="btnSubmit" value="Submit" class="btn btn-success" />
<!-- Modal Popup -->
<div id="MyPopup" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                <h4 class="modal-title">
            <div class="modal-body">
            <div class="modal-footer">
                <input type="button" id="btnClosePopup" value="Close" class="btn btn-danger" />



public static string SendParameters(string name)
    return string.Format("Name: {0}", name);


Public Shared Function SendParameters(ByVal name As String) As String
    Return String.Format("Name: {0}", name)
End Function