0

I am trying to load html page inside jquery dialog but it does not work. below is my jquery code. "openTerms" function is triggered when there is click in link. it opens up the dialog but give me resource not found error. however "terms.html" reside in the project and added as item.

 <a id="someclientid" name="someuniqueid" href="javascript:void(0);" onclick="openTerms();">Terms and Conditions</a> 


    <script>
            function openTerms()
    {
        pathArray = location.href.split( '/' );
        protocol = pathArray[0];
        host = pathArray[2];
        url =  pathArray[0] + '//' + pathArray[1]  + '//' + pathArray[2] + '//' + pathArray[3] 

        url = url + "/Orchard.Club" + "/terms.html";

        var page = url;

        alert(url);

        var $dialog = $('<div></div>')
                       .html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>')
                       .dialog({
                           autoOpen: false,
                           modal: true,
                           height: 700,
                           width: 1100,
                           title: "Terms and Conditions",
                           buttons: {                                   
                               Cancel: function () {
                                   $(this).dialog("close");
                               }
                           },

                           close: function () { setFormControls(); },
                           open: function () {

                           }

                       });

        $dialog.dialog('open');
    }

</script>

}

1 Answer 1

1

After loading the contents you need to show the dialog box

$.get(url, function (data) {
    $("#dialog").html(data).dialog('open');
});

Also try the load() method load content like

$("#dialog").load(url, function(){
    $(this).dialog('open');
});
Sign up to request clarification or add additional context in comments.

2 Comments

i am able to open dialog but give me resource not found error. however "terms.html" reside in the project and added as item. see my modified post
i need to open a file that is added to current project e.g. terms.html should be opened in jquery dialog? how can i achieve this?

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.