0

I'm currently working on a multi-step query form which can be found at: http://jsfiddle.net/xSkgH/47/.

I'm trying to submit the variables via jQuery AJAX (process.php will handle the processing) and refresh the div last-step with the div in the process.php called result. How can I achieve this?

I've so far managed to accomplish this using the jQuery form plugin by malsup ( http://jquery.malsup.com/form/).

I want to switch over to a load request and have been told to use the following:

$ ( '#last-step' ). load ( url , data , function (){})

Which will send a post request, fills the html content of 'last-step' with whatever the url printed out into the response html. But I'm not sure how to replace the code below and use .load:

The code I currently using can be found here: http://codetidy.com/2522/

Many thanks in advance.

4

2 に答える 2

2
$('#test').submit( function() {
    var data =  $(this).serialize();
    var url = "http://www.google.com";

    $.post(url, data, function(data) {
      $('#last-step').html(data);
    });

    return false;
});

If you can use "post" instead.

Else you need to loop all input area's and combine them into an object to send with the load.

于 2012-04-16T21:56:13.303 に答える
1

If you do not want to write this from scratch I suggest you look for jQuery wizard plugin that handles the steps and the naviagtion between them for you. Doing a fast google search I found a couple:

Getting this correct can be hard, especially if you want to use the browser history to enable the use of the back button to go back to previous steps, so try to leverage existing work. Also: determine what you want to do before you pick the plugin so you won't run into limitations halfway through.

于 2012-04-16T20:53:00.590 に答える