日期:2014-05-16 浏览次数:20435 次
<?php
$ary = array('result'=>0,'message'=>'跨域成功');
$json = json_encode($ary);
echo "$json;";
?>
$.getJSON("http://www.s94994.com/json.php",function(d){
// alert(1)
alert(d+'....40')
});
string strJson=GetWebContent("http://www.s94994.com/json.php",Encoding.UTF8);
private string GetWebContent(string Url, Encoding encoding)
{
string strResult = "";
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
//声明一个HttpWebRequest请求
request.Timeout = 90000;
//设置连接超时时间
request.Headers.Set("Pragma", "no-cache");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream streamReceive = response.GetResponseStream();
//Encoding encoding = Encoding.UTF8;
StreamReader streamReader = new StreamReader(streamReceive, encoding);
strResult = streamReader.ReadToEnd();
streamReceive.Dispose();
st