ajax uncaught exception: send(null)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: ajax uncaught exception: send(null)

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Posts
    1

    Smile ajax uncaught exception: send(null)

    hii
    i am trying to get response from domain https://www.dex-intl.com/data_access...ch_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]

    Code:
    <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>
    Last edited by PeejAvery; April 12th, 2010 at 07:22 PM. Reason: Added code tags.

  2. #2
    Join Date
    May 2010
    Posts
    3

    Re: ajax uncaught exception: send(null)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center