function Post(Price,Year,Month,FoPcs,Curr,PKID,ProID,RealRS,SDDC)
{
var str;
str='Price='+Price;
str=str+'&Year='+Year;
str=str+'&Month='+Month;
str=str+'&FoPcs='+FoPcs;
str=str+'&Curr='+Curr;
str=str+'&PKID='+PKID;
str=str+'&ProID='+ProID;
str=str+'&RealRS='+RealRS;
str=str+'&SDDC='+SDDC;var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var xmldoc = new ActiveXObject("Msxml.DOMDocument");
xmlhttp.Open("POST","PostForecast.aspx",false);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.Send(str);xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.responseText)
}
}
if(xmlhttp.status!=200)
{
alert ('网络故障(xmlhttp.status='+xmlhttp.status+'),请稍后再试!');
return false;
}
var info = xmlhttp.responseText;
info=info.substr(0,(info.indexOf('<!')));
if(info.indexOf('成功')>0)
{
window.opener=null;window.returnValue =1;window.close()
}
alert(info);
}
{
var str;
str='Price='+Price;
str=str+'&Year='+Year;
str=str+'&Month='+Month;
str=str+'&FoPcs='+FoPcs;
str=str+'&Curr='+Curr;
str=str+'&PKID='+PKID;
str=str+'&ProID='+ProID;
str=str+'&RealRS='+RealRS;
str=str+'&SDDC='+SDDC;var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var xmldoc = new ActiveXObject("Msxml.DOMDocument");
xmlhttp.Open("POST","PostForecast.aspx",false);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.Send(str);xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.responseText)
}
}
if(xmlhttp.status!=200)
{
alert ('网络故障(xmlhttp.status='+xmlhttp.status+'),请稍后再试!');
return false;
}
var info = xmlhttp.responseText;
info=info.substr(0,(info.indexOf('<!')));
if(info.indexOf('成功')>0)
{
window.opener=null;window.returnValue =1;window.close()
}
alert(info);
}
解决方案 »
- 如何打印滚动条以外的区域????难了一个星期了,都快急死了!
- 谁有比较好的web版mail界面的代码呀?
- Session取值问题(在线等 急)
- Basepage类与.net2.0中母版页有什么区别?详解并修改这段代码.
- 求开源,中轻量级ORM,带有代码生成器的
- 我下面代码写入webconfig没有起到重写作用,怎么回事?
- 中文字体样式不起作用,为何?
- 全局变量的传递问题,谢谢
- asp.net中创建新目录问题:Directory.CreateDirectory
- 刷新一下含用户控件的网页出现:未将对像引用设置到对像的实例?
- 高分求救-如何改变datagrid的显示格式
- 用ajax的xmlhttp.send(data)向后台发送请求的时候;,后台没处理,data是个XML数据,是什么原因,如何得到data的值,找了些办法都没成功
我在發xml前會先把左尖括號替換掉,server接收了再替換回來。
因爲不想去掉安全驗證,笨方法哦
lz有可能會遇到這個問題的
function GetDataFromServer(url,data)
{
var xmlHttp = getXmlHttp() ;
var serverUrl = url ;
if(xmlHttp)
{
window.status = "数据更新中...." ;
xmlHttp.open("post",serverUrl,true) ;
xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded") ;
xmlHttp.send(data) ;
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
if(xmlHttp.status == 200)
{
window.status = "数据更新完成" ;
//var result = xmlHttp.responseText ;
//if(document.getElementById("load_"+id))
//{
// document.getElementById("load_"+id).style.display='none';
// document.getElementById("node"+id).innerHTML+=result ;
//}
//document.getElementById("hello").innerHTML=result;
}
}
}
}
}
function GetNodeInfo(xmlData)
{
var url = "WebForm9.aspx";
GetDataFromServer(url,xmlData) ;
}
function getXmlHttp()
{
var obj = null ;
try
{
obj = new ActiveXObject("Msxml2.XMLHTTP") ;
return obj ;
}
catch(e)
{
try
{
obj = new ActiveXObject("Microsoft.XMLHTTP") ;
return obj ;
}
catch(o)
{
obj = null ;
}
}
return null ;
}
//==================================================================== //============================调用
GetXml();
hellodata=document.getElementById("myXml").value;
if(hellodata)
//debugger
GetNodeInfo(hellodata);
//============================public class WebForm9 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
try
{
System.IO.Stream stream = Request.InputStream;
//string xmlString = Request["data"].ToString();
//XmlDocument layout = new XmlDocument();
System.Xml.XmlDocument layout = new XmlDocument();
try
{
layout.Load(stream);
layout.Save(Server.MapPath("layout/yyy.xml"));
}
catch
{
;
}
//string xmlString=layout;//stream.ToString();
OperateFile fileOp=new OperateFile();
try
{
if(fileOp.WriteFile(Server.MapPath("layout/yyy.xml"),"yyy_"))
Response.Write("<script>alert('保存成功!')</script>") ;
}
catch(Exception ex)
{
string str=ex.Message;
} Response.Clear();
Response.Write(stream.ToString());
Response.End();
}
catch(Exception sysException)
{
}
}
根据你的情况应该是javascript没有提交数据。