473,473 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XMLHttpRequest.open Permission Denied

4 New Member
Can someone please tell me why I get a "Permission denied to call method XMLHttpRequest.open" error? Here is my script:

Expand|Select|Wrap|Line Numbers
  1. var xmlHttp
  2.  
  3. function runSearch(element){
  4.     xmlHttp=GetXmlHttpObject();
  5.  
  6.     if( xmlHttp == null ){
  7.         alert("I think it is time to upgrade your browser");
  8.         return;
  9.     }
  10.  
  11.      var url = 'http://search.yahooapis.com/WebSearchService/V1/webSearch?';
  12.              url += 'appid=EKQTGpvV34GFx1J7y44QjPRfmvGmAAYKSdY3oUHcWH7Dgg6wsUNoxWaBU4_uf.lSjo0-';
  13.              url += '&results=20';
  14.              url += '&site=www.espn.com';
  15.              url += '&output=json';
  16.              url += '&query=' + element
  17.              url += '&callback=' + callback;
  18.     try{
  19.         xmlHttp.onreadystatechange = callback;
  20.         xmlHttp.open("GET", url, true);
  21.         xmlHttp.send(null);
  22.     }
  23.     catch(e){
  24.         alert(e);
  25.     }
  26. }
  27.  
  28. function callback(jsonObject){
  29.     alert(jsonObject.ResultSet.totalResultsAvailable);
  30. }
  31. function GetXmlHttpObject()
  32. {
  33. var xmlHttp=null;
  34. try
  35.   {
  36.   // Firefox, Opera 8.0+, Safari
  37.   xmlHttp=new XMLHttpRequest();
  38.   }
  39. catch (e)
  40.   {
  41.   // Internet Explorer
  42.   try
  43.     {
  44.     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  45.     }
  46.   catch (e)
  47.     {
  48.     xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  49.     }
  50.   }
  51. return xmlHttp;
  52. }
  53.  
Thank you for your help
Oct 7 '07 #1
2 3750
acoder
16,027 Recognized Expert Moderator MVP
It's from a different domain. Let your server-side script make the cross-domain request and return the result. Use Ajax to make the request to the script on your own domain.
Oct 7 '07 #2
pbmods
5,821 Recognized Expert Expert
Heya, Johhny.

Please use CODE tags when posting source code:

[CODE=javascript]
JavaScript code goes here.
[/CODE]
Oct 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: K | last post by:
Hey Guys, The problem i'm having is that our company is provided with a xml link. My job is to create a javascript menu based on the information retrieved from that link. We/I do not have access...
2
by: dx27s | last post by:
Hi all, I'm working with the XMLHttpRequest object. I receive the following error message: "Permission denied to call method XMLHttpRequest.open" This occurs in Firefox only. IE works fine. ...
20
by: chris.schwalm | last post by:
This is part II of this <a...
1
by: vikas.khengare | last post by:
Hi Friends.... I have AJAX code which giving "Permission denied to call method XMLHttpRequest.open" error. This error fired by FireFox 1.0 and IE 6 and with Tomacat 5.x. This code work very...
1
by: Charlie | last post by:
I am trying to make an XMLHttpRequest which violates the default "same- origin"policy in Firefox. I checked the archives and found a method that should work but it does not. Below is the test code...
1
by: shotokan99 | last post by:
hi, i wanted to check if the url is existing using xmlhttprequest. my browser is firefox. the code goes like this: window.onload=ini var xr= new XMLHttpRequest(); function ini(){...
2
gagandeepgupta16
by: gagandeepgupta16 | last post by:
Hi i am working on webservice that uses one client side javascript which takes in data from html control, process and POST it to destination webservice. every thing in the logic is ok and...
8
by: sbettadpur | last post by:
hello I am using xmlHttpRequest method in my application, this method is giving problem in the following browsers 1) Internet Explorer 7 2) Mozila Firefox(2.0.0.16) I got solution for...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.