Click to See Complete Forum and Search --> : ajax uncaught exception: send(null)


zamandil
April 9th, 2010, 06:29 AM
hii
i am trying to get response from domain https://www.dex-intl.com/data_access_layer/search_box_dal.php through ajax call, but getting following exception

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/projects/mtdb/Ajaxcall.php :: loadajex :: line 39" data: no]

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Testing Ajex</title>
<script type="text/javascript">
function getHTTPObject()
{
var xhr = false;
if (window.XMLHttpRequest)
{
xhr = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
try
{
xhr = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
xhr = false;
}
}
}
return xhr;
}
var request;

function loadajex(){
var request = getHTTPObject();
request.open("GET",'https://www.dex-intl.com/data_access_layer/search_box_dal.php?msgno=333333',false);
request.send(null);
if(request.status==200){
alert(request.responseText);
}
}
</script>
</head>

<body>
<div>Call to <a href="" onclick="loadajex()">Dex-intel.com</a></div>
<div id="response"></div>
</body>
</html>

scbluser
May 17th, 2010, 06:32 AM
If this domain "https://www.dex-intl.com" is different from the page domain requesting for the ajax call it will not work.

Ajax calls can be performed to the same domain (and context) as the current page. You cannot initialize an ajax request to http://www.google.com and get a valid response.

The browsers are built with this security in place.