Why not use the examples from chromium for Cross Origin XHR:
http://code.google.com/chrome/extensions/samples.html

 <http://code.google.com/chrome/extensions/samples.html>If you want to use
JQuery, make sure you import the JQuery JS and follow their Ajax API,
http://api.jquery.com/jQuery.ajax/

<http://api.jquery.com/jQuery.ajax/>
-Mohamed Mansour


On Mon, Jan 11, 2010 at 11:52 PM, Ildiko Pocsai
<ildiko.pocsa...@gmail.com>wrote:

> Hi!
>
> I found this function to make a jquery ajax request in an older version of
> chrome bird. The function looks like this:
>
> ajaxRequest: function(url, callback, context, params, httpMethod) {
>     if(!httpMethod)
>       httpMethod = "GET";
>     var _this = this;
>     $.ajax({
>       type: httpMethod,
>       url: TwitterLib.URLS.BASE + url + ".json",
>       data: params,
>       dataType: "json",
>       timeout: 6000,
>       beforeSend: function(xhr) {
>         var auth = $.base64.encode(_this.username + ":" + _this.password);
>         xhr.setRequestHeader("Authorization", "Basic " + auth);
>       },
>       success: function(data, status) {
>         callback(true, data, status, context);
>        },
>       error: function (request, status, error) {
>         callback(false, null, status, context);
>       }
>     });
>   }
>
> I would need a similar function but which doesn't require authentication.
> Could anyone help me by telling where to modify this code. I tried to delete
> the beforeSend part but it doesn't work.
>
> Thanks,
>
> Ildi
>
> On Sun, Jan 10, 2010 at 9:58 PM, PhistucK <phist...@gmail.com> wrote:
>
>> Make sure you set the domain in the "permissions" section in the manifest.
>>
>> ☆PhistucK
>>
>>
>> On Sun, Jan 10, 2010 at 12:18, ildi <ildiko.pocsa...@gmail.com> wrote:
>>
>>> Hello!
>>>
>>> I'm trying to develop an extension that retrieves messages from a
>>> blog, but I receive a strange error at httprequest. The request is
>>> executed because readystate = 4 but the responsetext is empty and
>>> status is null. I post my code here:
>>>
>>> function s1(){
>>>                        var url = "
>>> http://www.cirip.ro/php/firefox/mesajev2.php?";;
>>>
>>>
>>>  url+="user="+document.getElementById("login").value;
>>>
>>>  url+="&pass="+document.getElementById("pass").value;
>>>
>>>                        url+="&lang=RO";
>>>                        ajax(url);
>>>           }
>>>
>>>           var httpRequest = null;
>>>
>>>           function ajax(url){
>>>
>>>                        httpRequest = new XMLHttpRequest();
>>>                        httpRequest.open('GET', url, true);
>>>                        httpRequest.onreadystatechange = infoReceived;
>>>
>>>                        httpRequest.send('');
>>>
>>>           }
>>>
>>>
>>>           function infoReceived(){
>>>
>>>                                var output = httpRequest.responseText;
>>>
>>>                                if (httpRequest.readyState == 4){
>>>
>>>  document.getElementById("signin").style.visibility = "hidden";
>>>
>>>  document.getElementById("workspace").style.display = "";
>>>
>>>                                }
>>>           }
>>>
>>> Could anyone tell me what the problem is. The url used by ajax
>>> function is corect because if I put it directly in the browser the
>>> messages appear. So I really don't have an idea what is the matter
>>> with responsetext. Any help is welcome.
>>>
>>> Thanks!
>>>
>>> Ildi
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Chromium-extensions" group.
>>> To post to this group, send email to
>>> chromium-extensi...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> chromium-extensions+unsubscr...@googlegroups.com<chromium-extensions%2bunsubscr...@googlegroups.com>
>>> .
>>> 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 chromium-extensi...@googlegroups.com.
> To unsubscribe from this group, send email to
> chromium-extensions+unsubscr...@googlegroups.com<chromium-extensions%2bunsubscr...@googlegroups.com>
> .
> 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 chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/chromium-extensions?hl=en.

Reply via email to