Permissão negada Erro XMLHttpRequest

    <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN>
<html xmlns=>
    <title>Calling a Web Service Using XmlHttpRequest</title>

    <script type=text/javascript language=javascript> 

var xmlhttp; 

var XMLContent='<XML ID=Transaction><Transaction>'+
'<![CDATA[ Director of R&D Software product  (Multimedia)]]>'+
'<![CDATA[ Brian Mc Fadden]]>'+
'<![CDATA[ Director of R&D Software product concepts Multimedia Web 2.0]]> '+
'<JobDetDesc><![CDATA[ <P class=MsoNormal style=MARGIN: 0cm 0cm 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto><STRONG>Director of R&D Software product concepts to</STRONG>  build a the new prototyping team and processes from the ground up, utilizing an agile development model, manage the R&D team develop a strong vision and be able to clearly articulate the direction the group will take in terms of methodologies and tools in technologies such as J2EE, .NET, Flash, AJAX, DHTML, JavaScript, take marketing requirements from the principal investigators and write functional requirement documents, manage budget for R&D development,  manage the projects developed by the internal team and vendors. </P>  <P class=MsoNormal style=MARGIN: 0cm 0cm 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto>To get this new role you will have a degree in IT / Software and over 5 years plus doing cutting edge development in R&D/ prototyping and leading cutting edge development teams in a software production / product environment, project management and process management skills (AGILE) and demonstrated experience working on product innovation and releases. You may be working in educational gaming, social networking, Web 2.0 applications, mobile technologies, learning management systems, online courseware or shareware. </P>  <P class=MsoNormal style=MARGIN: 0cm 0cm 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto> </P>  <P class=MsoNormal style=MARGIN: 0cm 0cm 0pt>The package is to €105K + Bonus + VHI + Pension + relocation package where applicable + stock options may be negotiated. There are great career advancement opportunities. To discuss this and other opportunities please send an up-to-date resume to <A></A> or call +353 1 6489113 in confidence. Your details will not be sent to any third party without your consent. </P>  <P class=MsoNormal style=MARGIN: 0cm 0cm 0pt> </P>]]>'+
'<JobQues1><![CDATA[ ]]>'+
'<JobQues2><![CDATA[ ]]>'+
'<JobQues3><![CDATA[ ]]>'+

function on_click() 


        xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');

     catch (ex)
      xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');

 else if (window.XMLHttpRequest) 
   xmlhttp = new window.XMLHttpRequest();;

var xmlToSend = '<?xml version=1.0 encoding=utf-8?>'+
'<soap:Envelope xmlns:xsi= xmlns:xsd= xmlns:soap=>'+ 
'<InsertXML xmlns=>'+

var szUrl;
szUrl = '';

xmlhttp.onreadystatechange = state_Change;, szUrl, true); 

xmlhttp.setRequestHeader (SOAPAction,; 

xmlhttp.setRequestHeader (Content-Type, text/xml); 



function state_Change() 


// if xmlhttp shows loaded 

if (xmlhttp.readyState==4) 


// if OK 

if (xmlhttp.status==200) 






alert(Problem retrieving XML data +xmlhttp.responseText); 





            Click the button to call the web service</h1>
        <input type=button onclick=return on_click(); value=OK />
    <div id=responseDiv>

Publicado 10/12/2008 em 07:59
fonte usuário
Em outras línguas...                            

3 respostas


XmlHttpRequest só pode ser usado para chamar os serviços locais para o domínio / servidor de onde a página está sendo servido.

Assim, se você está servindo uma página a partir de:

Você não pode fazer um XMLHttpRequest para:
Respondeu 10/12/2008 em 08:01
fonte usuário


Desde que você está definindo Content-type, você também precisa configurá-lo para usar UTF-8. E eu acho que é suposto ser application/xml( fonte ).

xmlhttp.setRequestHeader("Content-Type", "application/xml; charset=utf-8");

Caso contrário, você verificou que o XML está formatado corretamente? Tente salvá-lo como um arquivo XML completo e abri-lo no seu browser.

Respondeu 10/12/2008 em 08:37
fonte usuário

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more