Solved

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Javascript to set controls visibility 5 36
jquery progress bar 3 43
How to make a moving character 3 57
Browser Chrome downloads colored link 5 41
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

810 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