11 个解决方案
#1
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);
}
#2
如果得到data的值,data不是自己送的吗?
#3
debug不就知道情況了
我在發xml前會先把左尖括號替換掉,server接收了再替換回來。
因爲不想去掉安全驗證,笨方法哦
lz有可能會遇到這個問題的
我在發xml前會先把左尖括號替換掉,server接收了再替換回來。
因爲不想去掉安全驗證,笨方法哦
lz有可能會遇到這個問題的
#4
打了断点,也没法调试,好像被请求的页面没处理这个请求
#5
这个方法是不是没有调用?
#6
//====================================================================
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)
{
}
}
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)
{
}
}
#7
webform9.aspx不处理请求
#8
先确认JavaScript是否已经提交了数据,可以使用alert()方式确定程序流程
根据你的情况应该是javascript没有提交数据。
根据你的情况应该是javascript没有提交数据。
#9
会不是会缓存的问题?
#10
alert(data)表示已经向服务端提交了,可是webform9.aspx没处理
#11
webform9.aspx 接收到data了吗
#1
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);
}
#2
如果得到data的值,data不是自己送的吗?
#3
debug不就知道情況了
我在發xml前會先把左尖括號替換掉,server接收了再替換回來。
因爲不想去掉安全驗證,笨方法哦
lz有可能會遇到這個問題的
我在發xml前會先把左尖括號替換掉,server接收了再替換回來。
因爲不想去掉安全驗證,笨方法哦
lz有可能會遇到這個問題的
#4
打了断点,也没法调试,好像被请求的页面没处理这个请求
#5
这个方法是不是没有调用?
#6
//====================================================================
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)
{
}
}
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)
{
}
}
#7
webform9.aspx不处理请求
#8
先确认JavaScript是否已经提交了数据,可以使用alert()方式确定程序流程
根据你的情况应该是javascript没有提交数据。
根据你的情况应该是javascript没有提交数据。
#9
会不是会缓存的问题?
#10
alert(data)表示已经向服务端提交了,可是webform9.aspx没处理
#11
webform9.aspx 接收到data了吗