javascript - how to change a obj value in the uploader (ajax)? -
i still try change 1 value on thish script via js (remotepath), please give me informations :)
thank you!
$('#uploader_div').ajaxupload( { url: 'upload.php', droparea: '#drop_here', remotepath: 'user/user1/', <-- how change value ...
like this
remotepath: 'user/user2/'
update:
<div id="uploader_div"></div> <a id="link" href="#" onclick="newvalue();"> change user2 </a> <!--change click--> <script> var uplobj = { url: 'upload.php', droparea: '#drop_here', remotepath: 'user/user1/', // change click autostart: true, hideuploadbutton: true, removeonsuccess: true, maxconnections: 0, maxfilesize: '20m', allowext: ['mp3'] }; function newvalue() { uplobj.remotepath = 'user/user2/'; // change click link.style.display = 'none'; }; $('#uploader_div').ajaxupload(uplobj); </script>
you can change object anytime before ajax call if have reference it.
var obj = { url: 'upload.php', droparea: '#drop_here', remotepath: 'user/user1/' }; obj.remotepath = 'user/user2/'; $('#uploader_div').ajaxupload(obj);
edit in response more code
i read through docs supposed pass standard jquery options object ajaxupload. right have mix of jquery options , data perhaps see jquery docs more info on settings valid.
a simple fix might putting current data in data options attribute.
$('#uploader_div').ajaxupload({data: obj});
Comments
Post a Comment