ajax成功之后在执行,ajax传入成功后执行后台方法
做一個(gè)網(wǎng)站,再頁面讀取一段文字后,點(diǎn)擊按鈕,用ajax將文字傳回后臺(tái),現(xiàn)在我希望ajax返回成功后,執(zhí)行另外一段后臺(tái)方法,
請(qǐng)問有什么好方法嗎?
[WebMethod]
public static string GetStr(string s)
{
linkWord = s;
return linkWord;
}
private void BtCompare()
{
//在頁面選中一段句子,在某個(gè)地方彈出一個(gè)按鈕,點(diǎn)擊按鈕,將選中的句子傳入到下面的s當(dāng)中,然后調(diào)用方法,將兩個(gè)東西傳入到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.";//在前臺(tái)選中語句,傳入到這里
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:\\學(xué)習(xí)檔案\\Reading\\Reading\\report.html ";//保存到當(dāng)前目錄下
p.StandardInput.WriteLine(str);
p.StandardInput.WriteLine();
p.StandardInput.AutoFlush = true;
p.StandardInput.WriteLine("exit");
p.StandardOutput.ReadToEnd();
p.Close();
Report.Text = "";
Utils uu = new Utils();
//String[] ss = uu.subSentenceASC(s);//先長(zhǎng)后短句
String[] ss = uu.subSentenceDESC(stxt);//先短后長(zhǎng)句
int count = 0;
foreach (string aa in ss)
{
Report.Text += ++count + "、" + aa + "
";
}
}
總結(jié)
以上是生活随笔為你收集整理的ajax成功之后在执行,ajax传入成功后执行后台方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python深度神经网络算法_02.深度
- 下一篇: mariadb与mysql的兼容_「My