Solved

JQuery UI Ajax Dialog Box, Is it posisble for new content to load within the dialog box ?

Posted on 2010-11-13
3
763 Views
Last Modified: 2012-05-10
What I mean by this is :  once the dialog box has opened and a link is clicked within box it will bring the content into the full page rather than been contained within the dialog box.

You can see a working example here.. if you click "giftwrap this item" the dialog box pops up. If you then click add to cart within the dialog the whole page refreshes.

http://pa.creatico1.co.uk/pp/Capri/Nubuck_Olive_240.html

The code I am using is below is it possible for it to refresh within the dialog?


           <a class="ajax" href="http://pa.creatico1.co.uk/products1.asp?category=GiftWrap&product={partno}"> gift wrap this album?</a>              
           

 <script type="text/javascript">
    $(function (){
        $('a.ajax').click(function() {
            var url = this.href;
            var dialog = $('<div style="display:hidden"></div>').appendTo('body');
                       
            // load remote content
            dialog.load(

                url,  
                {},
                function (responseText, textStatus, XMLHttpRequest) {
                    dialog.dialog({width:950, height:800});
                }
            );
            //prevent the browser to follow the link
            return false;
        });
    });
    </script>
 
0
Comment
Question by:alexealden
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Sudaraka Wijesinghe earned 500 total points
ID: 34130511
Hi,

Instead of using a DIV as you dialog body, you can use an IFRAME. Then you can submit for or click links in the IFRAME and make them load in the IFRAME instead of the main window.

Check out this http://elijahmanor.com/webdevdotnet/post/jQuery-UI-Dialog-w-Resizable-iFrame.aspx
0
 

Author Comment

by:alexealden
ID: 34134520
That was exactly what I was after thank you again!
0
 
LVL 18

Expert Comment

by:Sudaraka Wijesinghe
ID: 34136514
Glad to help. Thanks for the points.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question