0

I know this question is asked already but I am not finding solution for this

Here is my jquery code:

    function openArmoryDialog(id) {
        var divID = $("#ArmoryDialogDiv");
        $.ajax({
            type: "GET",
            url: "/aoa_mvc/armory/Detail/" + id,
            cache: false,
            dataType: 'html',
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $(divID).html(errorThrown);
            },
            success: function (data, textStatus, XMLHttpRequest) {
                  $(divID).html(data);
            },
            complete: function (XMLHttpRequest, textStatus) {
                $('#ArmoryDialogDiv').dialog({
                    width: 500,
                    modal:true // This is not working
                });

            }
        });   
    }

I don't know why modal popup is not opening, I have tried many solutions but none is working for me

I included needed css file

Saurabh Gadariya
  • 191
  • 6
  • 20
  • 1
    What is your error getting in console? – Anto king Jul 09 '14 at 11:26
  • Please show the relevant HTML - we can't see that there is a div with that ID. Also is it definitely the ONLY div with that ID? Also please show your includes, we can't tell that jQuery or jQuery UI is included. – Popnoodles Jul 09 '14 at 11:28
  • Did you try to see the page on FireFox with FireBug enabled? – Nicolas Henrard Jul 09 '14 at 11:28
  • Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help http://xhr.spec.whatwg.org/ jquery-1.9.1.js:8492 TypeError: $.browser is undefined – Saurabh Gadariya Jul 09 '14 at 11:29
  • `var divID = $("#ArmoryDialogDiv");` and `$(divID)` - while I think jQuery checks and allows that to work, one of the `$()`s is redundant. – Popnoodles Jul 09 '14 at 11:29
  • 1
    You have not mentioned if you have included the jquery ui library. – Jai Jul 09 '14 at 11:30
  • Hi Saurabh, In my point of View you already defined ` var divID = $("#ArmoryDialogDiv");` then why your again using "$(divID)"? Thats not needed you can just use divID instead. And Please sure about adding the right JQuery library. Make sure you using the div ID **#ArmoryDialogDiv** for only one time in the page. If you post your code HTML we can look what goes wrong, above all my suggestions to check the problem. And look @ here for more info about your error http://stackoverflow.com/questions/22589393/cannot-make-http-request-javascript-ns-error-failure – Anto king Jul 09 '14 at 11:41
  • The code, as you have posted it, is correct. The problem is elsewhere. Possible investigation: Does your DOM contain an element with `id=ArmoryDialogDiv`? Can you see the `GET` request on the server? off-topic: You should also keep in mind `divID.html(dataFromServer)` is a XSS vulnerability – blgt Jul 09 '14 at 22:30

0 Answers0