Solved

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

Posted on 2012-03-13
2
378 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
[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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
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…

729 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