Jump to content

Submitting a form which includes files via Ajax. Field values are not submitted


Nikolas.A

Recommended Posts

I have the following code:

 

<form action="" method="post" enctype="multipart/form-data" name="form_posting" id="form_posting" onSubmit="return checkFields(this)";>

 

...some fields here...

 

<div id='ajaxDiv'></div>

<div id='ajaxDiv2'></div>

<div id='ajaxDiv3'></div>

 

...submit button...

</form>

 

here is an example of the ajax functions.

<script language="javascript" type="text/javascript">

                    <!--

                    //Browser Support Code

                    function ajaxFunction3(){

                        var ajaxRequest; // The variable that makes Ajax possible!

                        try {

                            // Opera 8.0+, Firefox, Safari

                            ajaxRequest = new XMLHttpRequest();

                        }

                        catch (e) {

                            // Internet Explorer Browsers

                            try {

                                ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");

                            }

                            catch (e) {

                                try {

                                    ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");

                                }

                                catch (e) {

                                    // Something went wrong

                                    alert("Your browser broke!");

                                    return false;

                                }

                            }

                        }

                        // Create a function that will receive data sent from the server

                        ajaxRequest.onreadystatechange = function(){

                            if (ajaxRequest.readyState == 4) {

                                var ajaxDisplay = document.getElementById('ajaxDiv3');

                                ajaxDisplay.innerHTML = ajaxRequest.responseText;

                            }

                        }

                        var courier_type = document.getElementById('courier_type').value;

                        var queryString3 = "?courier_type=" + courier_type;

 

                       

                        ajaxRequest.open("GET", "get_courier_input.php" + queryString3, true);

                        ajaxRequest.send(null);

                    }                 

                    //-->

                </script>

 

 

The fields that are inside the ajaxDivs are not available in the page that I process them.

Any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.