how around 'ns_error_illegal_value' blunder controlling ajax?
im only minute little ajax horizon re-usability little projects i've strike problem. fundamentally i 'ns_error_illegal_value' blunder while eventuality ask i've thought happening.
the html page
(trimmed nonetheless shows error)
<!doctype html open "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ajax test</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">
var finish = 4;
var ok = 200;
duty getxmlhttprequestobject()
{
var xmlhttprequestobject = false;
if(window.xmlhttprequest)
{
if(typeof xmlhttprequest != 'undefined')
{
try
{
xmlhttprequestobject = new xmlhttprequest();
}
locate (e)
{
xmlhttprequestobject = false;
}
}
}
else (window.activexobject)
{
try
{
xmlhttprequestobject = new activexobject('msxml2.xmlhttp');
}
locate (e)
{
try
{
xmlhttprequestobject = new activexobject('microsoft.xmlhttp');
}
locate (e)
{
xmlhttprequestobject = false;
}
}
}
else
{
xmlhttprequestobject = false;
}
relapse xmlhttprequestobject;
}
//the sure ajax object
duty ajaxrequest(p_requestmethod, p_destinationurl)
{
this.xmlhttprequestobject = getxmlhttprequestobject();
this.requestedmethod = p_requestmethod;
this.destinationurl = p_destinationurl;
this.xmlhttprequestobject.open(this.requestmethod, this.destinationurl);
this.onstatechange = function(callback)
{
this.xmlhttprequestobject.onreadystatechange = callback;
}
this.send = function(p_content)
{
this.xmlhttprequestobject.send(p_content);
}
this.getstate()
{
relapse this.xmlhttprequestobject.readystate;
}
this.getresponsetext = function()
{
relapse this.xmlhttprequestobject.responsetext;
}
this.getresponsestatus = function()
{
relapse this.xmlhttprequestobject.status;
}
this.getresponsestatustext = function()
{
relapse this.xmlhttprequestobject.statustext;
}
}
var request;
duty getdata()
{
ask = new ajaxrequest('post', 'http://www.kalekold.net/ajax/ajax.php');
request.onstatechange = statechange;
request.send();
}
duty statechange()
{
window.alert("state: " + request.getstate());
window.alert("response: " + request.getresponsestatus());
window.alert("response text: " + request.getresponsestatustext());
if(request.getstate() == finish && request.getresponsestatus() == ok)
{
outcome = request.getresponsetext();
window.alert(result);
}
}
</script>
</head>
<body>
<form>
<textarea name="textarea" rows="10" cols="80"></textarea><br />
<input type="button" value="load" onclick="getdata();">
</form>
</body>
</html>
the php file:
<?php
$xml = <<< prolog
<?xml version="1.0" encoding="iso-8859-1"?>
prolog;
$xml .= "<results>";
$xml .= "<result>";
$xml .= "<firstname>gary</firstname>";
$xml .= "<secondname>willoughby</secondname>";
$xml .= "<age>35</age>";
$xml .= "</result>";
$xml .= "<result>";
$xml .= "<firstname>sara</firstname>";
$xml .= "<secondname>gostick</secondname>";
$xml .= "<age>35</age>";
$xml .= "</result>";
$xml .= "</results>";
header("content-type: text/xml");
echo $xml;
?>
the full error:
uncaught exception: [exception... "component returned disaster code: 0x80070057 (ns_error_illegal_value) [nsixmlhttprequest.open]" nsresult: "0x80070057 (ns_error_illegal_value)" location: "js support :: http://www.kalekold.net/ajax/ :: ajaxrequest :: line 63" data: no]
line 0
i only can't where it's going wrong, any ideas?
Comments
Post a Comment