I have a button which opens a popup :
var RowView = Backbone.View.extend({
events: {
'click .my-transaction-grid span.my-icon-export' : 'myExport',
},
myExport: function(){
var uniqueKey = this.model.get('uniqueKey');
var initSubmitButton = function(){
$("#submitButton").on('click', function(response, postdata){
window.open('downloadFile.action?uniqueKey=' + key + "&$myFolder=" + $("#myFolder").val(), '_self');
});
};
var callback = function(){
initSubmitButton(uniqueKey);
initPaginationGrid("myGrid", "foldersForm", uniqueKey, true, null, "folderPopup.action", initSubmitButton);
};
loadPopupEdit("folderPopup.action", {uniqueKey: uniqueKey, editMode: true}, callback);
The popup is a jsp file, containing a dropdown list from which I can select a value :
<div id="POPUP-CONTENT" class="my-container-popup">
<s:form id="foldersForm">
<div class="my-content">
<table class="my-table">
<tr>
<td class="my-field><s:select id="myFolder" name="myFolder" list="myFoldersList" listKey="code" listValue="value" emptyOption="true" tabindex="3"/></td>
</tr>
</table>
</div>
</s:form>
</div>
How can I get the updated value of $("myFolder")
, when I have selected a value from the dropdown list, in the script where I call window.open()
?
What I am getting :
downloadFile.action?uniqueKey=ir8ej38&myFolder=
What I'd like to get :
downloadFile.action?uniqueKey=ir8ej38&myFolder=selectedFolder
Ok figured it out, should have used
window.open('downloadFile.action?uniqueKey=' + key + "&$myFolder=" + $("#myFolder :selected").text(), '_self');
instead of
window.open('downloadFile.action?uniqueKey=' + key + "&$myFolder=" + $("#myFolder").val(), '_self');