Solved

jQuery and Ajax, writing results to a div on a parent page

Posted on 2012-03-13
2
372 Views
Last Modified: 2012-03-13
I have a web page with several links on it.  When a link is clicked it pops up a jQuery modal box, with a form loaded from another page using ajax:

function getInfo(prodID){
            
$.ajax({
type: "POST",
url: "getProduct.asp",
data: "prodID=" + prodID,
timeout: 6000,
success: function(data, textStatus){
if (data!="ERROR")
{
     $( "#dialog-form" ).html(data);
    $( "#dialog-form" ).dialog( "open" );
}
  else
{
                                          
}
}
});
return(false);
}

getprod.asp is a form that loads with specific fields.  when the user clicks submit on the getprod.asp form, i want to process another ajax page (addtocart.asp) - and then update a div (#cartInfo) on the original page with updated cart information.

I'm not sure how to communicate from the getprod.asp's Ajax results to the parent page that launched the modal dialog box.    $( "#dialog-form" ).html(data); is what I use to update the modal dialog box  - and I imagine it would be something like - $this.$parent("#cartInfo").html(data); - but I don't know.  

Any ideas?  I don't know if I need to post more information.

Thanks for your help!
0
Comment
Question by:slightlyoff
2 Comments
 
LVL 9

Accepted Solution

by:
wellhole earned 500 total points
ID: 37714932
A modal dialog box is still part of the page. $("#cartInfo") will grant you access to that element on your page even if you call it from the modal box.
0
 
LVL 1

Author Closing Comment

by:slightlyoff
ID: 37715075
you frickin' ROCK!  Thanks :)  

That was much easier than I was thinking it would be.

I really appreciate your quick response!
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

Title # Comments Views Activity
How to print dynamic Google map and directions? 1 23
how can i turn the array into an object 4 39
Javascript 2 17
2 separate CSS animations 2 16
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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…

790 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