URL Corrupted

URL Corrupted

I have several modules that allows the user to update information in a database. Before adding or editing the information I verify that the entered data is valid. If the information is not valid I inform the user of the problem via an alert message. Simple and straight forward.

My problem is that when there is a problem the URL gets corrupted. This is normal URL...

  1. www.myappname.com/update_Module.php

And this is after the invalid request...

  1. www.myappname.com/update_Module.php?tableName=squarefeet&tableIndex=sqft_ID&indexNumber=464&form_BegDate=2014-01-01&form_EndDate=2014-01-31&NewDate=&NewDate=&buttonEdt=&sqft_Project=06801.83&sqft_Phase=113&sqft_Date=2014-01-19&sqft_Amount=3353&sqft_Rate=&sqft_Complete=1.00&sqft_Comment=

This is the code I use for updating the record...

  1.     var request;
       
        // bind to the submit event of our form
        $("#form_edit").submit(function(event){
            // abort any pending request
            if (request) {
                request.abort();
            }
           
            if ( validateForm() ) {
                // setup some local variables
                var $form = $(this);
                   
                // let's select and cache all the fields
                var $inputs = $form.find("input, select, textarea");
               
                // serialize the data in the form
                var serializedData = $form.serialize();
           
                // let's disable the inputs for the duration of the ajax request
                $inputs.prop("disabled", true);
               
                // define constants to be passed as parameters
                var whichButton = event.originalEvent.explicitOriginalTarget.id
                if ( whichButton == "buttonAdd") {
                    var updateType = 'add';
                } else if ( whichButton == "buttonEdt" ) {
                    var updateType = 'edt';
                } else if ( whichButton == "buttonDel" ) {
                    var updateType = 'del';
                } else {
                    var updateType = "";
                }
               
                var tableName = $('#tableName').val();
                var indexName = $('#tableIndex').val();
                var idxNumber = $('#indexNumber').val();
               
                // Build string for query input
                var sType   = "?type=" + updateType;
                var sTable  = "&table=" + tableName;
                var sIndex  = "&index=" + indexName;
                var sRec    = "&rec=" + idxNumber;
                var Params  = sType + sTable + sIndex + sRec;
               
                request = $.ajax({
                    url: "files_json/aed_Record.php" + Params,
                    type: "post",
                    data: serializedData
                });
           
                // callback handler that will be called on success
                request.done(function (response, textStatus, jqXHR){
                    // log a message to the console
                    sMessage = 'Data record successfully updated'
                    //alert(sMessage);
                    console.log(sMessage);
                    resetForm();
                });
           
                // callback handler that will be called on failure
                request.fail(function (jqXHR, textStatus, errorThrown){
                    // log the error to the console
                    errMessage = "The following error occured: " + textStatus, errorThrown
                    alert(errMessage);
                    console.error(errMessage);
                });
           
                // callback handler that will be called regardless
                // if the request failed or succeeded
                request.always(function () {
                    // reenable the inputs
                    $inputs.prop("disabled", false);
                });
           
                // prevent default posting of form
                event.preventDefault();
               
            } else {
                // Do nothing
            }
           
        }); // End of submit function


















































































Any ideas as to why the URL is getting corrupted?

TIA for any assistance.

jdadwilson