2048
登录
没  有  难  学  的  前  端
登 录
×
<返回上一级

ajax传入成功后执行后台方法

ajax方法作者:猿2048志愿者

做一个网站,再页面读取一段文字后,点击按钮,用ajax将文字传回后台,现在我希望ajax返回成功后,执行另外一段后台方法,
请问有什么好方法吗?

  [WebMethod]
    public static string GetStr(string s)
    {
        linkWord = s;
        return linkWord;
    }

    private void BtCompare()
    {
        //在页面选中一段句子,在某个地方弹出一个按钮,点击按钮,将选中的句子传入到下面的s当中,然后调用方法,将两个东西传入到o.txt和s.txt,然后比较,接着切割句子,最后输出
        //string s = "As a linguist, he acknowledges that all varieties of human language, including non-standard ones like Black English, can be powerfully expressive--there exists no language or dialect in the world that cannot convey complex ideas.";//在前台选中语句,传入到这里

        demo gg = new demo();
        string[] sentence = gg.SentenceDetect(linkWord);
        string otxt = gg.Parse(sentence);//放在o.txt
        FileStream fotxt = new FileStream(@"D:\\parser\\o.txt", FileMode.Create);
        StreamWriter ot = new StreamWriter(fotxt);
        ot.Write(otxt);
        ot.Flush(); //清除缓存
        ot.Close();
        ot.Dispose();
        fotxt.Close();

        DoParser doq = new DoParser();
        string stxt = doq.parser(linkWord);//放在s.txt
        FileStream fstxt = new FileStream(@"D:\\parser\\s.txt", FileMode.Create);
        StreamWriter st = new StreamWriter(fstxt);
        st.Write(stxt);
        st.Flush();
        st.Close();
        st.Dispose();
        fstxt.Close();

        Process p = new Process();
        p.StartInfo.FileName = @"cmd.exe";
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardInput = true;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.RedirectStandardError = true;
        p.StartInfo.CreateNoWindow = true;
        p.Start();

        string str = "D:\\BCompare\\BCompare.exe @D:\\parser\\BCconsle.txt D:\\parser\\o.txt D:\\parser\\s.txt D:\\学习档案\\Reading\\Reading\\report.html ";//保存到当前目录下
        p.StandardInput.WriteLine(str);
        p.StandardInput.WriteLine();
        p.StandardInput.AutoFlush = true;
        p.StandardInput.WriteLine("exit");
        p.StandardOutput.ReadToEnd();
        p.Close();
        Report.Text = "<iframe src='report.html'frameborder='0' height=350px width=100%></iframe>";

        Utils uu = new Utils();
        //String[] ss = uu.subSentenceASC(s);//先长后短句
        String[] ss = uu.subSentenceDESC(stxt);//先短后长句
        int count = 0;
        foreach (string aa in ss)
        {
            Report.Text += ++count + "、" + aa + "<br />";
        }
    }
猜你喜欢
(十万案例免费下载)
评论
点击刷新
评论
相关问题

分享“案例”中大奖

开始分享 中奖规则
分享链接:
联系方式:
2021-04-11中奖名单(每日10名)
×添加代码片段