jQuery does not perform multipart/form-data encoding.  It uses
JavaScript's encodeURIComponent function to encode data so the correct
enctype is application/x-www-form-urlencoded.

Mike


On 6/11/07, Neil Merton <[EMAIL PROTECTED]> wrote:

Hi all,

I'm trying to use the following example with a form that contains
multipart/form-data in it but the ajax part won't work -
http://www.shawngo.com/gafyd/index.html

If I remove the enctype="multipart/form-data" from the form tag it
works.

Here's the code...

<script type="text/javascript" src="/code/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
        $('#loading').hide();
        $('#product_code').blur(function()
        {
                $('#loading').show();
                $.post("checkproductcode.cfm",
                {
                        product_code: $('#product_code').val()
                },
                function(response)
                {
                        $('#result').fadeOut();
                        setTimeout("finishAjax('result', 
'"+escape(response)+"')", 400);
                });
                return false;
        });
});
function finishAjax(id, response)
{
        $('#loading').hide();
        $('#'+id).html(unescape(response));
        $('#'+id).fadeIn();
}
</script>

<form action="/checkproductcode.cfm" method="post" enctype="multipart/
form-data">
        <input type="text" name="product_code" id="product_code"
class="button" size="50" />
        <span id="loading"><img src="ajax-loader.gif" alt="Loading..." /></
span>
        <span id="result"></span>
        <br />
        <input type="submit" value="Send" />
</form>

Any ideas?

Thanks in advance for any replies


Reply via email to