Using the callback function for .load()

Using the callback function for .load()

Hello everyone, I'm a jQuery novice and I think I've gotten myself in over my head here. Would appreciate some help if possible. Thanks.

I have a #Calculate button with a click function attached which, when clicked, iterates through a form and sends the users input values, via $_GET, to a php script called 'prepsession.php'. Here the inputs are validated and sanitized, a session is started and some session variables are created using the form input values. If there are any errors I want error messages displayed beside the form. Everything works fine up to this point.

If this script runs ok without giving any errors I would like to fire another php script called 'printsummary.php' which accesses the previously created session variables and inserts them into a div #PanelContent. The reason I am using separate php scripts for this is that I would like to be able to print my data in various different ways so I have numerous php print scripts accessing the session variables.

What mistake am I making with the load function here?

  1. /* Event handler for the calculate button */
  2. $('#Calculate').click(function(){
  3. var params = $('#inputform').serialize();
  4. var url = 'prepsession.php'+ '?' + params;
  5. $('#ErrorArea').load(url, function(){
  6. $('PanelContent').load('printsummary.php')
  7. });
  8. });