Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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);
                                    }
                                });
share|improve this question
    
obj.property = 'foo'; also see this –  T I Jan 6 '12 at 16:33
    
Sorry? How it should be then? –  Clark Kent Jan 6 '12 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: '' –  T I Jan 6 '12 at 16:39

1 Answer 1

up vote 1 down vote accepted
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:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.