Solved

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

Posted on 2010-11-13
3
741 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now