使用jquery保存弹出数据 [英] Saving the popup data using jquery

查看:62
本文介绍了使用jquery保存弹出数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在下载创建新选项。如果用户单击新建选项,则弹出窗口将显示保存按钮。在该弹出窗口中,用户将输入数据,然后用户将此数据保存在服务器上。



并像这样传递该脚本,

I am having a drop down with "Create New" option. If user clicks "Create New" option then popup window will display with save button. In that popup window, user will enter data and after user will save this data on server.

And passing that script like this,

<button runat="server" id="Savefile" class="btn btn-primary" onclick="savefile()";





当用户点击保存按钮然后数据a必须存储在给定的路径中。但它没有执行任何操作。当我点击保存按钮时它会自动关闭。能帮我解决一下这个问题。



这段代码有什么不对吗?



我尝试过:



这是用于在弹出窗口中保存数据的jQuery函数。



When user clicks "Save" button then data has to store in that given path. but it is not performing any action. And it is closing automatically when I click "Save" button. Can you please help me to solve this problem.

Any wrong in this code?

What I have tried:

This is jQuery function for save the data in a popup.

<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('<table><tbody><tr><td>' + scrtabledata.comment + '</td><td>' + scrtabledata.DropDownList2 + '</td><td>' + scrtabledata.DropDownList1 + '</td></tr></tbody></table>');
            });
          }
        });
      });
    });
  }; 
</script>



这是jQuery弹出窗口的代码:


This is the code for jQuery popup:

<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>

推荐答案

document ) .ready( function (){
(document).ready(function() {


' #Savefile')。click( function (){
('#Savefile').click(function() {


.ajax ({
url:' D:\C#.Net\Scramble.txt'
数据类型: json
方法:' post'
data:scrtabledata,
success: function (){
var scrtabledata =
.ajax({ url: 'D:\C#.Net\Scramble.txt', datatype: "json", method: 'post', data : scrtabledata, success: function() { var scrtabledata =


这篇关于使用jquery保存弹出数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆