1

How to populate param. value for the http://valums.com/ajax-upload/ javascript correctly?

I want to pass some image title by

 params: { 
     param1: imgTitle
 },

Where $("#ImageTitle").val(); refers to <input type="text" id="ImageTitle" name="ImageTitle" value="" />

Any help please!

Thank you!!!

enter image description here

UPDATES:

The final solution is here.

<script type="text/jscript">

                                var uploader = new qq.FileUploader({
                                    element: document.getElementById('file-uploader-demo1'),
                                    allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
                                    sizeLimit: 2147483647, // max size
                                    action: '/TradeshowSpeakers/UploadFile',
                                    multiple: false,
                                    onSubmit: function (id, filename) {
                                        this.params.param1 = $("#ImageTitle").val();
                                    },
                                    onProgress: function (id, fileName, loaded, total) {
                                    },
                                    onComplete: function (id, fileName, responseJSON) {
                                        //alert(responseJSON[0].Image);
                                    }
                                });
3
  • obj.property = 'foo'; also see this Commented Jan 6, 2012 at 16:33
  • Sorry? How it should be then? Commented Jan 6, 2012 at 16:36
  • 1
    hmm I think something you'd replace var imgTitle with this.params.param1 = $('#imageTitle').val(); and change param1: imgTitle to param1: '' Commented Jan 6, 2012 at 16:39

1 Answer 1

1
var imgTitle ...

having been declared in a function is not in scope (visible to) the assignment of param1 and so it should be replaced with

this.params.param1 = $('#imageTitle').val();

Also as teh assignment of param1: imgTitle is now irrelevant it can just be assigned an empty string or false etc.

A couple of references in understanding whats going on here:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.