Since your not requesting from a different origin, make sure you use the
full URL with the extension ID. An example would be something like this:

  function getVersion() {
    var version = 'NaN';
    var xhr = new XMLHttpRequest();
    xhr.open('GET',* chrome.extension.getURL*('manifest.json'), false);
    xhr.onreadystatechange = function() {
      if (this.readyState == 4) {
        var manifest = JSON.parse(this.responseText);
        version = manifest.version;
      }
    };
    xhr.send();
    return version;
  }

On Wed, Dec 9, 2009 at 12:39 PM, Thangaraju Ramasamy <[email protected]>wrote:

> Sreekanth,
>
>
> Did you set permissions to your domain?
>
> In manifest you need to set permission to access the data.
> Ref: http://code.google.com/chrome/extensions/manifest.html#permissions
>
>
>
>
> ~ Thangaraju Ramasamy
>
> On Tue, Dec 8, 2009 at 19:23, Sree <[email protected]> wrote:
>
>> I have this piece of code where it sends an ajax request from a webpage.
>>
>> var baseURI = document.baseURI;
>> var docURI = baseURI.split('#')[1];
>>
>> var url = "some request of my own";   // Not from a different origin
>> var xmlhttp;
>> xmlhttp=new XMLHttpRequest();
>> xmlhttp.onreadystatechange=function() {
>> if(xmlhttp.readyState==4) {
>> alert('ready');
>>   }
>> };
>> xmlhttp.open("GET",url,true);
>> xmlhttp.send();
>>
>> This code is not working, even though i dint see any errors in a window
>> when i open using Ctrl+Shift+J
>>
>> where as if I change the if condition to xmlhttp.readyState==1 the alert
>> fires. with rest of any numbers the alert is not firing.
>>
>> Am I doing anything wrong...
>>
>> --
>> -Thanks
>> -Srikanth.G
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Chromium-extensions" group.
>> To post to this group, send email to [email protected]
>> .
>> To unsubscribe from this group, send email to
>> [email protected]<chromium-extensions%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/chromium-extensions?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Chromium-extensions" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<chromium-extensions%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/chromium-extensions?hl=en.
>



-- 
Mohamed Mansour

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to