0

I am developing an MVC with Bootstrap App. I am calling a Bootstrap PopUp windows via Jquery.

This is my call

  <div style="float:left;width:100%;height:30px;" class="Sees">
            <img class="btnNuevoMsg" src="~/Content/Images/NuevoMsg.png" onclick="New()" />
        </div>

On New() function I do some validation. Dependind of this validation, I can Redirect to another View or, call Controller Method that returns a Partial View, whitch I render in Bootstrap tag.

this is my bootstrap tag.

<div class="modal fade" id="myModalLog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

</div> 

My Jquery function is like this.

 $.ajax(
           {
               type: "POST",
               url: '@Url.Action("ShowLogUser","Home")',
               //data: { search: _search },
               success: function (result) {
                   $('#myModalLog').html(result);
                   $('#myModalLog').modal();
//                   $('#myModalLog').modal('toggle');
//                   $('#myModalLog').modal('show');
               },
               error: function (req, status, error) {
                 
               }
           });

It Works fine...

the problem I find is that I can not use

data-toggle="modal"

via Jquery...

I do not want to close PopUp Windows when User clicks outside the Windows.

I have tried using $('#myModalLog').modal('toggle'); as it is shown in the example, but it does not work.

How can I use ths property in Jquery?

Thanks

2 Answers 2

2

add a backdrop property to your model like this

$("#myModalLog").modal({backdrop: "static"});

example here

https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_ref_js_modal_backdrop&stacked=h

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

Comments

0
$(function() {
    $('body').on('click', '.btn', function(e) {
        $('#myModal6').modal('show');
    });
});

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.