Solved

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

Posted on 2010-11-13
3
771 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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…

730 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