Hi,

I am using jQuery Form Plugin's ajaxForm method to upload a file to a
third party server. Uploading is working fine, using this approach as
I am able to see the file uploaded in the third party server. But I
need to get hold of the response coming back from the server as I need
to save some response data at my side. So I am using a success
callback method. But problem is everytime it is calling my error
callback method instead of the success callback method. Can anybody
help me what am I doing wrong?

Here is how I call the ajaxForm method:

<script type="text/javascript">
        $(function() {

            var options = {
                url: 'http://api.kickapps.com/rest/upload/photo/
27970',
                type: 'post',
                iframe: true,
                dataType: 'json',
                success: function (data, status)
                {
                    alert(status);
                    if(typeof(data.error) != 'undefined')
                                        {
                                            if(data.error != '')
                                                {
                                                        alert(data.error);
                                                }else
                                                {
                                                        alert(data.msg);
                                                }
                                        }
                                }, // post-submit success callback

                                error: function (data, status, e)
                                {
                                        alert(status);
                                        //alert(e);
                                } // post-submit error callback
            };

            //ajax form submit
            $('#form2').ajaxForm(options);

        });

Thanks
Prasenjit

Reply via email to