Hi,

I was trying a similar thing(requesting local file through ajax) using
jquery and it was not working. Turns out, the status of the response
always says error, even when response.responseText is OK.
Why is this? I just commented and "if" clause checking for status ==
"success" to make it work, but doesn't feel good, although is OK for
now.

Cheers,

Marcos

On Aug 29, 9:28 am, Manticore <[email protected]> wrote:
> I just tried your code and it worked! Thanks!
>
> Though, it makes me wonder why I can't do it through jQuery, as it's
> using XMLHttpRequest in the background too.
>
> Now I'll continue developing my extension, but without access to
> Inspector window as it's broken in latest dev release :-(
>
> On Aug 29, 4:59 pm, os0x <[email protected]> wrote:
>
>
>
> > I wrote sample code.
> > Thanks
> > ----
> > <!DOCTYPE html>
> > <html>
> > <head><meta charset="utf-8"></head>
> > <body>
> > <div class="toolstrip-button">
> >     <span id ="mytext"></span>
> > </div>
> > <script type="text/javascript">
> > function get_manifest(callback){
> >   var xhr = new XMLHttpRequest();
> >   xhr.onload = function(){
> >       callback(JSON.parse(xhr.responseText));
> >   };
> >   xhr.open('GET','./manifest.json',true);
> >   xhr.send(null);}
>
> > get_manifest(function(manifest){
> >     document.getElementById('mytext').textContent = manifest.name + "
> > ver " + manifest.version;})
>
> > </script>
> > </body>
> > </html>
> > ----
> > Shogo
>
> > On Aug 29, 4:54 pm, Manticore <[email protected]> wrote:
>
> > > Yes, I've tried using both "manifest.json" and chrome.extension.getURL
> > > ('manifest.json'). When I'm watching the Inspector window I can see
> > > that it gets the correct URL, only that request doesn't give anything
> > > back in response, it's just blank.
>
> > > I got an image of the request here: tinyurl.com /chrome-ext-ajax
> > > [remove spaces]. I'm using jQuery, but that shouldn't be a problem,
> > > right?
>
> > > P.S I happen to send this same message with my other Google account
> > > (which isn't verified) so there will probably two posts by me soon.
> > > Heh.
>
> > > On Aug 29, 12:18 am, Aaron Boodman <[email protected]> wrote:
>
> > > > That is a very creative solution.
>
> > > > I'm actually surprised it isn't working. Have you tried using both
> > > > relative and absolute URLs?
>
> > > > - a
>
> > > > On Fri, Aug 28, 2009 at 12:39 PM, Manticore<[email protected]> wrote:
>
> > > > > Hi,
>
> > > > > I'm currently working on an extension where I would like to get the
> > > > > current version of the extension that I'm running. I figured it would
> > > > > be pretty easy by just doing a AJAX request to manifest.json and I'll
> > > > > have a JavaScript object to play with. Though, after I've sent the
> > > > > request I get nothing back in the response.
>
> > > > > Is there any permission I need to add to be able to do AJAX requests
> > > > > to files in my extension?
>
> > > > > Thanks
> > > > > Manticoro
--~--~---------~--~----~------------~-------~--~----~
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