C#问题后台return了一个值过来,前台应该怎么接?
代码如下:js代码:Ext.onReady(function(){Ext.get('btn').on('click',function(){varname=Ext.get...
代码如下:
js代码:
Ext.onReady(function () {
Ext.get('btn').on('click', function () {
var name = Ext.get('name').dom.value;
var basePars = { 'name': name };
Ext.Ajax.request({
url: '../../../Tools/Pdfsc.asmx/GetPdf',
params: { 'name': name },
method: 'POST',
success: function (xml,action) {
//submitData('../../../Tools/Pdfsc.asmx/GetPdf', basePars);
alert(xml);
Ext.get('div').innerHtml(xml);
alert("成功");
alert(name);
}
});
});
});
后台代码:
public string GetPdf(string name) {
StringBuilder sb = new StringBuilder();
Common.PdfSc pdf = new Common.PdfSc();
string filepath= "E:\\project\\LDJDK\\Web\\FilesUpload\\" + name;
pdf.TurnTheImageToPdf(filepath);
string path = "../../../FilesUpload/" + name + ".pdf";
sb.Append("<object id='pdf1' width=80% height='760' classid='CLSID:CA8A9780-280D-11CF-A24D-444553540000'>");
sb.Append("<param name='SRC'value="+path+"/>");
sb.Append("</object>");
string xml = sb.ToString();
Console.WriteLine(name);
return xml;
现在怎么才能接收这个值?我用的方法接不到。求帮助 展开
js代码:
Ext.onReady(function () {
Ext.get('btn').on('click', function () {
var name = Ext.get('name').dom.value;
var basePars = { 'name': name };
Ext.Ajax.request({
url: '../../../Tools/Pdfsc.asmx/GetPdf',
params: { 'name': name },
method: 'POST',
success: function (xml,action) {
//submitData('../../../Tools/Pdfsc.asmx/GetPdf', basePars);
alert(xml);
Ext.get('div').innerHtml(xml);
alert("成功");
alert(name);
}
});
});
});
后台代码:
public string GetPdf(string name) {
StringBuilder sb = new StringBuilder();
Common.PdfSc pdf = new Common.PdfSc();
string filepath= "E:\\project\\LDJDK\\Web\\FilesUpload\\" + name;
pdf.TurnTheImageToPdf(filepath);
string path = "../../../FilesUpload/" + name + ".pdf";
sb.Append("<object id='pdf1' width=80% height='760' classid='CLSID:CA8A9780-280D-11CF-A24D-444553540000'>");
sb.Append("<param name='SRC'value="+path+"/>");
sb.Append("</object>");
string xml = sb.ToString();
Console.WriteLine(name);
return xml;
现在怎么才能接收这个值?我用的方法接不到。求帮助 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询