weixin_33694620 2017-09-07 14:06 采纳率: 0%
浏览 46

参数错误

so consider this case:

The workspace is a website similar to Google Drive. (Keep that in Mind)

I have a Delete .icon to delete a file from my files list,

and as soon as i request delete file WebMethod using Ajax i would like to also retrieve the new files array, within the same response.

So far i have Tried this.

consider also that the work flow is -

1- request Delete file using Ajax from the Element ID

2- after deleting (that is successfully already done) i call another function that retrieve the files from their RealPath

RealPath : is where those files Placed on the serve.

So far this is the code i have Tried.

 $(".fa-trash-o").click(function () {
    var ID = $(this).closest(".ImageBlock").attr('id');
    var path = $(this).closest(".ImageBlock").attr('Get')
    var RealID = parseInt(ID);
    $.ajax({
        type: "POST",
        url: "../../Home.aspx/DeleteFile",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        data: JSON.stringify({ 'ID': RealID, 'RealPath': path }),
        success: function (result, xhr, request) {

            OnSuccess(result.d);

        }
    });



});

and this is my Back-end webMethod

public static string DeleteFile(int ID, string RealPath)
    {
        try


      {

                FilesBAL FilesBAL = new FilesBAL();
                if (FilesBAL.Delete(ID) == true) {
                return GetDataByParent(RealPath);
                }
                else
                {
                    return Statment.Error_Delete;

                }

            }
            catch (Exception ex)
            {
                return Statment.Error_Delete;
            }

        }

GetDataByParent: A method that returns Data serialized as JSON

Additional info might be needed: i am using MySql StoredProcedures to execute the DB queries.

What are the Steps to check on that ? Since the same method (GetDataByParent) used before to get the home page files is used when deletion occur, And it works 100% fine everywhere else.

  • 写回答

1条回答 默认 最新

  • elliott.david 2018-10-23 02:19
    关注

    Turned out it passes a wrong retrieved RealPath parameter from the Stored Procedure .

    Using some Debugging Tips i found here

    评论

报告相同问题?

悬赏问题

  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像