When I try to do this, firebug does not alert me of anything wrong,
the form is posted normally (no ajax).
What mistake am I making?

// requires jquery.forms plugin
jQuery.fn.jsonForm = function(onSuccess) {
    this.ajaxForm({
    dataType: 'json',
    success: function(data) {
        if (data.Message) {
            alert(data.Message); // my json reply always has these 2
fields
        }
        if (data.ActionUrl != null) {
            top.location = data.ActionUrl;
        }
        if (onSuccess != null) {
            onSuccess(data); // what if onSuccess has an empty
signature?
        }
    }
});
}

So I can call it like so:

        var onSuccess = function(data){
                $.each(data.Customer, function(i, item){
                        $('#searchResultCustomers').append("<dd>"+ item.Name 
+"</dd>");
                });
        });
        $('.jsonFormCustomer').jsonForm(onSuccess);

How could I call jsonForm without a null param, too?

Help greatly appreciated!

Reply via email to