0

I have a Form like this in asp Classic ..

<form method="post" name="AddItemForm" id="AddItemForm" action="/files/includes/CartControl.asp" style="display:inline;"> 

// bunch of Hidden Fields.

Then a SUBMIT button.

action of the form takes all the hidden fields and then after processing them redirects user to a CART page.

now what I want to do is....I want user to click on ADD TO CART button, however I want user to stay on the product page while form submits to a new window (not a javascript new window...something like lightbox/colorbox/fancybox DIV etc).

I looked into many jQuery plugins but could not get a satisfied answer...which plugin is BEST for my case? any simple example?

basicly I want to submit to a new overlay div and within that DIV redirect user to a new page to show Product Info.

Thanks

highwingers
  • 1,649
  • 4
  • 21
  • 39

3 Answers3

1

It seems that you are looking for some functionality for asynchronous form submission. There is this jQuery AJAX Form plugin that provides AJAX functionality for forms. You will have something like:

$('#AddItemForm').submit( function() {
    // Submit asynchronously
    $( this ).ajaxSubmit( function() {
        // Form processing is done
        // Redirect to the shopping cart page
    });

    // Show a modal or a fancy "please wait" message

    // Prevent default submission
    return false;
});
Grampa
  • 1,623
  • 10
  • 25
0

the simplest way (in my view) is to add target attribute to the form which will open new window while the current page won't chage...

i100
  • 4,529
  • 1
  • 22
  • 20
0

You can find some info in this answer, the code from one of the answers:

$('input#submitButton').click( function() {
    $.post( 'some-url', $('form#myForm').serialize(), function(data) {
         ... do something with response from server
       },
       'json' // I expect a JSON response
    );
});

In "do something with response" you can take the data or url and load it into an overlay div. If it's a URL, you can use jquery .load :

$('#result').load('ajax/test.html');

If it's html (or data which you wrap in html), just do

$('#result').html(theHTML)
Community
  • 1
  • 1
TheZuck
  • 3,513
  • 2
  • 29
  • 36