Tech Rocks

Coldfusion
Java
JQuery

An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more...

Sunday, April 10, 2011

Submiting a form using jquery ajax

Example:

function postit_7(obj) {
    var recurring_transaction = $("#recurring_transaction").val();
    var isrecurring = true;
       
    
    
    var url = ajaxInterface;
    url = url + '?fn=1&' + (new Date()).getTime();
   
    id = "step3_container_1";
    showpreloader(id);
   
   
    obj.ajax({            
        type: 'POST',
        url: url,
        data: $('#payForm').serialize(),
        success: function(data, status) {
            //alert(data);
            var content = obj.parseJSON(data);
            var test = content["key"];
           
            var ERROR_CODE = content["ERROR_CODE"];
            var RESPONSE_MESSAGE = content["RESPONSE_MESSAGE"];
           
            $('#id_transaction', window.parent.document).val(test);
           
            if(ERROR_CODE != 0)
                completedtransaction_2_1(ERROR_CODE,RESPONSE_MESSAGE);
            else
                completedtransaction();
        },
        error: function(e){
            alert("postit_4() function error: "+e.statusText);
        },
        complete: function(){
       
        }
        ,cache: false
    });
}

0 comments :

Post a Comment