Rocky Singh
Rocky Singh

Reputation: 15420

Passing dynamic value via param

I am using this plugin http://valums.com/ajax-upload/. I am using this code :

var uploader = new qq.FileUploader({
    // pass the dom node (ex. $(selector)[0] for jQuery users)
    element: document.getElementById('file-uploader'),
    // path to server-side upload script
    action: '/server/upload',
    params: {item1:$('#txtName').val() }
});

Now when the request is made to server always the blank value goes to server instead of what the actual value is (I changed the value of textbox after the page has been loaded). I think the first default value of textbox is passed in this case. My question how can I pass the dynamic value of textbox to server ?

Upvotes: 0

Views: 1375

Answers (3)

Andrey Popov
Andrey Popov

Reputation: 33

onSubmit: function(id, fileName) {
    uploader.setParams({
        action: 'import_data',
        overwrite: $('#tracking_overwrite').is(':checked')?1:0
    });
}

Upvotes: 2

Jose
Jose

Reputation: 187

I've sent parameters and receive it via QueryString in ASP.NET using the data option:

var uploader = new qq.FileUploader({
    // pass the dom node (ex. $(selector)[0] for jQuery users)
    element: document.getElementById('file-uploader'),
    // path to server-side upload script
    action: '/server/upload',
    data: {item1:$('#txtName').val() }
});

Server code:

string item1 = Request["item1"];

Upvotes: -2

Luke
Luke

Reputation: 8407

$("#txtName").change(function() {
  uploader.setParams({item1: $(this).val()});
});

Upvotes: 3

Related Questions