我正在使用「Create New」選項下拉菜單。如果用戶點擊「新建」選項,彈出窗口將顯示保存按鈕。在該彈出窗口中,用戶將輸入數據並在用戶將該數據保存在服務器上之後。使用jQuery保存彈出窗口數據
這是用於將數據保存在彈出窗口中的jQuery函數。
<script type = "text/javascript" >
function savefile() {
$(document).ready(function() {
$('#Savefile').click(function() {
$.ajax({
url: 'D:\C#.Net\Scramble.txt',
datatype: "json",
method: 'post',
data : scrtabledata,
success: function() {
var scrtabledata = $('#modaltable'); //Table ID
scrtabledata.empty();
$(data).each(function() {
scrtabledata.append('<tr><td>' + scrtabledata.comment + '</td><td>' + scrtabledata.DropDownList2 + '</td><td>' + scrtabledata.DropDownList1 + '</td></tr>');
});
}
});
});
});
};
</script>
而且通過像這樣的腳本,
<button runat="server" id="Savefile" class="btn btn-primary" onclick="savefile()">Save </button>
這是jQuery的彈出代碼:
<script type="text/javascript">
$(function() {
//Attach click event to your Dropdownlist
$("#<%= DropDownConfigFile.ClientID %>").change(function() {
//Get the selected valu of dropdownlist
selection = $(this).val();
//If its one then show the dialog window. You can change this condition as per your need
if (selection == 1) {
//Show the modal window
$('#myModal').modal('show');
}
});
});
</script>
當用戶點擊「保存」按鈕,然後數據在該存儲給定路徑。但它沒有執行任何操作。當我點擊「保存」按鈕時它會自動關閉。你能幫我解決這個問題嗎?
此代碼有任何錯誤?
你不想使用的onclick功能,因爲你正在使用jQuery的$( '#SAVEFILE')triggreing點擊功能。單擊( –
你能請給出代碼,其中包括您的彈出窗口和js –
Java腳本函數addRow(){ var table = document.getElementById(「modaltable」); var rowCount = table。 rows.length; var row = table.insertRow(rowCount); var colCount = table.rows [1] .cells.length;對於(var i = 0; i
kiran