-----Ö»Òªµ÷ÓÃÒÔÏÂAJAX ´úÂë¾Í³öÏÖHTTP ´íÎó 403 ----
C#.netÖÐ £¬Èç¹ûµ÷ÓÃÒÔÏ´úÂë¾Í»á³öÏÖÏÂÃæµÄ´íÎó¡£Çë¸ßÊÖÖ¸½Ì¡£
HTTP ´íÎó 403 - ½ûÖ¹·ÃÎÊ
Internet Explorer
function postdata(msg,url,data)
{
var xmlhttp=createxmlhttp();
xmlhttp.open("post", url, true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.onreadystatechange=callbackpassagain;
xmlhttp.send(data);
}
function createxmlhttp()
{
var xmlhttp=false;
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
if (xmlhttp.overrideMimeType)
{
//ÉèÖÃMiMEÀà±ð
xmlhttp.overrideMimeType('text/xml');
}
}
return xmlhttp;
}
sf ,Ôõôµ÷Óà µÄ£¿
ºÃÏñÊÇÄãÇëÇóµÄÍøÒ³ÓÐÎÊÌâ
àÅ£¬ÓÐÀí
403Ó¦¸ÃÊÇûÓзÃÎʵÄȨÏÞ£¬±»½ûÖ¹·ÃÎÊÁË¡£
¿Ï¶¨ÄãÇëÇóµÄÒ³Ãæ³öÁËÎÊÌâ lz¼ì²éÏÂ
±»ÇëÇóµÄ
Ïà¹ØÎÊ´ð£º
ÔÚ¼ÒÑо¿ajax£¬¿´Á˱ðÈ˵ÄÒ»¸öÍøÉϹºÎïÉ̳ÇÏîÄ¿µÄÔ´´úÂ룬×Ô¼ºÒ²À´·Â±ðÈ˵Ķ«Î÷Á·Ï°Á·Ï°£¬Ã»Ïë³öÎÊÌâÁË£¡Ò»ÏµÄÕâЩ´úÂëÊÇÎÒ·ÂÕÕ±ðÈËдµÄ¡£ÎÒÊÇÏëÈÃ×¢²áµÄÈËÌîдÓû§Ãû£¬¹â±êÀ뿪Óû§ÃûºóÃæµÄÌîд¿Õ°×´¦ºóÁ¢¿ÌÀûÓÃaj ......
Èç½ðɽ´Ê°ÔÍøÒ³×óÉϽÇÉϵÄÿÈÕÒ»¾ä
$('#elementID').html();
Ó¦¸Ã¿ÉÒÔ°É
±ð³ÁÁË°¡£¡~£¡
ÎÊÌâ²»¹»ÇåÎú
document.getElementById("¿Ø¼þID").innerHtml;
h ......
´ó¼ÒºÃ£¬Çë¸ßÊÖÃÇÖ¸µã
ÎÒµÄservletÎļþÊÇ£º
package com.ljc.rank.ajax;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet ......
ÎÒÔÚÒ³ÃæÖÐÊäÈëÓ¢ÎÄÊÇÕý³£µÄ£¬ÊäÈëÖÐÎÄ·µ»ØµÄjson×îºóÉÙÁ˵㶫Î÷±È½ÏÕý³£·µ»ØÊÇ
{ "success ":true}
ÎÒ´«ÖÐÎĽøÈ¥·µ»Ø³öÀ´¾ÍÊÇ
{ "success ":fals
ΪÉÙÒ»²¿·Ö¶«Î÷
ÎÒÊÇÖ ......